Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change embedded video size and alignment on ipython notebook

I'm embedding a youtube video in one of my notebooks, and I'm not pleased with the size of the embedded video and the alignment.

I'm using

from IPython.display importYouTubeVideo
YouTubeVideo("U3iNcBtycaQ")

To embed the video, but I would like to align the video window to the center and change it's size to something bigger. How can I do that?

like image 390
idoda Avatar asked Apr 07 '14 18:04

idoda


People also ask

How do I increase screen size in Jupyter Notebook?

One more way to change the width of the Jupyter Notebook cell is by using themes. This will increase the cell width to 100%. Also you will be able to change the font and the font size.

How do you center a plot in Jupyter Notebook?

The Plots in the Jupyter Notebook can be Centered by Using HTML CSS Code Snippet. The Code for aligning the plots at center is shown below, by using this Code Snippet all the plots can be centered in the Jupyter Notebook. Make Sure you run this Code Snippet in Code Cell, not in Markdown Cell.


2 Answers

from IPython.display import YouTubeVideo
YouTubeVideo('U3iNcBtycaQ', width=1024, height=576)
like image 160
Rustam Avatar answered Dec 28 '22 22:12

Rustam


I found a way to do that, but it is HTML based and not Ipython based:

<div style="text-align: center">
    <iframe width="420" height="315" src=http://www.youtube.com/embed/U3iNcBtycaQ frameborder="4"></iframe>
</div>

Will appreciate an answer using the Ipython APIs.

like image 26
idoda Avatar answered Dec 28 '22 22:12

idoda