Show More
@@ -252,15 +252,19 b' class YouTubeVideo(IFrame):' | |||
|
252 | 252 | |
|
253 | 253 | Other parameters can be provided as documented at |
|
254 | 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 | 260 | def __init__(self, id, width=400, height=300, **kwargs): |
|
258 | 261 | self.id=id |
|
259 | 262 | src = "https://www.youtube.com/embed/{0}".format(id) |
|
260 | 263 | super(YouTubeVideo, self).__init__(src, width, height, **kwargs) |
|
264 | ||
|
261 | 265 | def _repr_jpeg_(self): |
|
262 | 266 | from urllib import urlopen |
|
263 |
return urlopen("https://img.youtube.com/vi/{id}/ |
|
|
267 | return urlopen("https://img.youtube.com/vi/{id}/default.jpg".format(id=self.id)).read() | |
|
264 | 268 | |
|
265 | 269 | class VimeoVideo(IFrame): |
|
266 | 270 | """ |
General Comments 0
You need to be logged in to leave comments.
Login now