Show More
@@ -0,0 +1,37 b'' | |||
|
1 | Enable to add extra attributes to iframe | |
|
2 | ======================================== | |
|
3 | ||
|
4 | You can add any extra attributes to the ``<iframe>`` tag | |
|
5 | since the argument ``extras`` has been added to the ``IFrame`` class. | |
|
6 | for example:: | |
|
7 | ||
|
8 | In [1]: from IPython.display import IFrame | |
|
9 | ||
|
10 | In [2]: print(IFrame(src="src", width=300, height=300, extras=["hello", "world"])._repr_html_()) | |
|
11 | ||
|
12 | <iframe | |
|
13 | width="300" | |
|
14 | height="300" | |
|
15 | src="src" | |
|
16 | frameborder="0" | |
|
17 | allowfullscreen | |
|
18 | hello world | |
|
19 | ></iframe> | |
|
20 | ||
|
21 | Using it, you can autoplay ``YouTubeVideo`` by adding ``'allow="autoplay"'``, | |
|
22 | even in browsers that disable it by default, such as Google Chrome. | |
|
23 | And, you can write it more briefly by using the argument ``allow_autoplay``. | |
|
24 | :: | |
|
25 | ||
|
26 | In [1]: from IPython.display import YouTubeVideo | |
|
27 | ||
|
28 | In [2]: print(YouTubeVideo("video-id", allow_autoplay=True)._repr_html_()) | |
|
29 | ||
|
30 | <iframe | |
|
31 | width="400" | |
|
32 | height="300" | |
|
33 | src="https://www.youtube.com/embed/video-id?autoplay=1" | |
|
34 | frameborder="0" | |
|
35 | allowfullscreen | |
|
36 | allow="autoplay" | |
|
37 | ></iframe> |
General Comments 0
You need to be logged in to leave comments.
Login now