@@ -11,22 +11,32 @@ class IFrame(object):
1111 Generic class to embed an iframe in an IPython notebook
1212 """
1313
14- def __init__ (self , id , width = 400 , height = 300 , ** kwargs ):
15- self .id = id
14+ iframe = """
15+ <iframe
16+ width="{width}"
17+ height={height}"
18+ src="{src}{params}"
19+ frameborder="0"
20+ allowfullscreen
21+ ></iframe>
22+ """
23+
24+ def __init__ (self , src , width , height , ** kwargs ):
25+ self .src = src
1626 self .width = width
1727 self .height = height
1828 self .params = kwargs
1929
2030 def _repr_html_ (self ):
21- """return the embed iframe for this video id """
31+ """return the embed iframe"""
2232 if self .params :
2333 from urllib import urlencode
2434 params = "?" + urlencode (self .params )
2535 else :
2636 params = ""
27- return self .iframe .format (width = self .width ,
37+ return self .iframe .format (src = self .src ,
38+ width = self .width ,
2839 height = self .height ,
29- id = self .id ,
3040 params = params )
3141
3242class YouTubeVideo (IFrame ):
@@ -53,32 +63,18 @@ class YouTubeVideo(IFrame):
5363 https://developers.google.com/youtube/player_parameters#parameter-subheader
5464 """
5565
56- iframe = """
57- <iframe
58- width="{width}"
59- height={height}"
60- src="http://www.youtube.com/embed/{id}{params}"
61- frameborder="0"
62- allowfullscreen
63- ></iframe>
64- """
66+ def __init__ (self , id , width = 400 , height = 300 , ** kwargs ):
67+ src = "http://www.youtube.com/embed/{0}" .format (id )
68+ super (YouTubeVideo , self ).__init__ (src , width , height , ** kwargs )
6569
6670class VimeoVideo (IFrame ):
6771 """
6872 Class for embedding a Vimeo video in an IPython session, based on its video id.
6973 """
7074
71- iframe = """
72- <iframe
73- width = "{width}"
74- height = "{height}"
75- src="http://player.vimeo.com/video/{id}{params}"
76- frameborder="0"
77- webkitAllowFullScreen
78- mozallowfullscreen
79- allowFullScreen
80- ></iframe>
81- """
75+ def __init__ (self , id , width = 400 , height = 300 , ** kwargs ):
76+ src = "http://player.vimeo.com/video/{0}" .format (id )
77+ super (VimeoVideo , self ).__init__ (src , width , height , ** kwargs )
8278
8379class ScribdDocument (IFrame ):
8480 """
@@ -92,16 +88,9 @@ class ScribdDocument(IFrame):
9288 ScribdDocument(71048089, width=800, height=400, start_page=3, view_mode="book")
9389 """
9490
95- iframe = """
96- <iframe
97- width = "{width}"
98- height = "{height}"
99- src="http://www.scribd.com/embeds/{id}/content{params}"
100- data-auto-height="false"
101- scrolling="no"
102- frameborder="0">
103- </iframe>
104- """
91+ def __init__ (self , id , width = 400 , height = 300 , ** kwargs ):
92+ src = "http://www.scribd.com/embeds/{0}/content" .format (id )
93+ super (ScribdDocument , self ).__init__ (src , width , height , ** kwargs )
10594
10695class FileLink (object ):
10796 """Class for embedding a local file link in an IPython session, based on path
0 commit comments