##// END OF EJS Templates
- changed to default jpeg image for YouTubeVideo representation...
Ben Kasel -
Show More
@@ -252,15 +252,19 class YouTubeVideo(IFrame):
252
252
253 Other parameters can be provided as documented at
253 Other parameters can be provided as documented at
254 https://developers.google.com/youtube/player_parameters#parameter-subheader
254 https://developers.google.com/youtube/player_parameters#parameter-subheader
255
256 When converting the notebook using nbconvert, a jpeg representation of the video
257 will be inserted in the document.
255 """
258 """
256
259
257 def __init__(self, id, width=400, height=300, **kwargs):
260 def __init__(self, id, width=400, height=300, **kwargs):
258 self.id=id
261 self.id=id
259 src = "https://www.youtube.com/embed/{0}".format(id)
262 src = "https://www.youtube.com/embed/{0}".format(id)
260 super(YouTubeVideo, self).__init__(src, width, height, **kwargs)
263 super(YouTubeVideo, self).__init__(src, width, height, **kwargs)
264
261 def _repr_jpeg_(self):
265 def _repr_jpeg_(self):
262 from urllib import urlopen
266 from urllib import urlopen
263 return urlopen("https://img.youtube.com/vi/{id}/0.jpg".format(id=self.id)).read()
267 return urlopen("https://img.youtube.com/vi/{id}/default.jpg".format(id=self.id)).read()
264
268
265 class VimeoVideo(IFrame):
269 class VimeoVideo(IFrame):
266 """
270 """
General Comments 0
You need to be logged in to leave comments. Login now