Ipython: Add height and width parameters to core.display.Video

Created on 23 Sep 2018  ·  4Comments  ·  Source: ipython/ipython

I'm viewing some videos in a notebook. The videos are larger than the width of my notebook so I can't see the entire frame unless I scroll left and right. I would like to specify a height and width so I can view the entire frame at once. I think it'd be pretty cool if it could resize automatically, but I'd be happy with the ability to set the height and width.

I can post some pictures if it helps.

ipython --version
6.5.0
jupyter lab --version
0.34.12

I've been doing this work around:

HTML(
    '<video controls width=500>'
    '<source src="video.mp4" type="video/mp4"/>'
    '</video>'
)

It seems like a simple PR, I could make it if you all like this.

Hacktoberfest good first issue help wanted

Most helpful comment

Hi @Carreau
Can I take this up for hacktoberfest? Could you give me some pointers for this?

All 4 comments

Sure feel free to send a PR if you looked at the code and it seem easy enough.
Feel free to ask if you want some pointers.

You can also wait a few days if you are participating to hacktoberfest.

Hi @Carreau
Can I take this up for hacktoberfest? Could you give me some pointers for this?

Hi @IpshitaC

The source code for the current Video object can be found here:

https://github.com/ipython/ipython/blob/94b894de4cef5b0e3cfb666d5328749205980d37/IPython/core/display.py#L1257-L1317

You will likely need to search how to update the _repr_html_ of it, or it' superclass to have a width= parameter

see #11353, I leave that open, as some improvements are possible, mainly if users are passing string like 10%, 12em it should still be valid sizes.

Was this page helpful?
0 / 5 - 0 ratings