##// END OF EJS Templates
Merge pull request #13213 from Kojoley/fix-bunch-of-doctests...
Merge pull request #13213 from Kojoley/fix-bunch-of-doctests Fix bunch of doctests

File last commit:

r26789:455e4afd
r26940:32497c8d merge
Show More
enable-to-add-extra-attrs-to-iframe.rst
38 lines | 1.1 KiB | text/x-rst | RstLexer
/ docs / source / whatsnew / pr / enable-to-add-extra-attrs-to-iframe.rst
Blazej Michalik
Reword the YouTubeVideo autoplay WN...
r26786 ``YouTubeVideo`` autoplay and the ability to add extra attributes to ``IFrame``
===============================================================================
yuji96
add docs: whats new entry
r26780
Blazej Michalik
Reword the YouTubeVideo autoplay WN...
r26786 You can add any extra attributes to the ``<iframe>`` tag using the new
``extras`` argument in the ``IFrame`` class. For example::
yuji96
add docs: whats new entry
r26780
In [1]: from IPython.display import IFrame
Blazej Michalik
Reword the YouTubeVideo autoplay WN...
r26786 In [2]: IFrame(src="src", width=300, height=300, extras=['loading="eager"'])
yuji96
add docs: whats new entry
r26780
Blazej Michalik
Reword the YouTubeVideo autoplay WN...
r26786 The above cells will result in the following HTML code being displayed in a
notebook::
yuji96
add docs: whats new entry
r26780
Blazej Michalik
Reword the YouTubeVideo autoplay WN...
r26786 <iframe
width="300"
height="300"
src="src"
frameborder="0"
allowfullscreen
loading="eager"
></iframe>
Related to the above, the ``YouTubeVideo`` class now takes an
``allow_autoplay`` flag, which sets up the iframe of the embedded YouTube video
such that it allows autoplay.
.. note::
Blazej Michalik
Reword a WN entry
r26789 Whether this works depends on the autoplay policy of the browser rendering
the HTML allowing it. It also could get blocked by some browser extensions.
Blazej Michalik
Reword the YouTubeVideo autoplay WN...
r26786
Try it out!
yuji96
add docs: whats new entry
r26780 ::
In [1]: from IPython.display import YouTubeVideo
Blazej Michalik
Reword the YouTubeVideo autoplay WN...
r26786 In [2]: YouTubeVideo("dQw4w9WgXcQ", allow_autoplay=True)
yuji96
add docs: whats new entry
r26780
Blazej Michalik
Reword the YouTubeVideo autoplay WN...
r26786 🙃