##// END OF EJS Templates
Merge pull request #13133 from yuji96/youtube-allow-autoplay...
Merge pull request #13133 from yuji96/youtube-allow-autoplay enable autoplay in embed youtube player

File last commit:

r26780:b7e2c5a8
r26781:100ff058 merge
Show More
enable-to-add-extra-attrs-to-iframe.rst
37 lines | 1.2 KiB | text/x-rst | RstLexer
/ docs / source / whatsnew / pr / enable-to-add-extra-attrs-to-iframe.rst
yuji96
add docs: whats new entry
r26780 Enable to add extra attributes to iframe
========================================
You can add any extra attributes to the ``<iframe>`` tag
since the argument ``extras`` has been added to the ``IFrame`` class.
for example::
In [1]: from IPython.display import IFrame
In [2]: print(IFrame(src="src", width=300, height=300, extras=["hello", "world"])._repr_html_())
<iframe
width="300"
height="300"
src="src"
frameborder="0"
allowfullscreen
hello world
></iframe>
Using it, you can autoplay ``YouTubeVideo`` by adding ``'allow="autoplay"'``,
even in browsers that disable it by default, such as Google Chrome.
And, you can write it more briefly by using the argument ``allow_autoplay``.
::
In [1]: from IPython.display import YouTubeVideo
In [2]: print(YouTubeVideo("video-id", allow_autoplay=True)._repr_html_())
<iframe
width="400"
height="300"
src="https://www.youtube.com/embed/video-id?autoplay=1"
frameborder="0"
allowfullscreen
allow="autoplay"
></iframe>