You are viewing an older version (9.11.0). Go to latest (9.13.0)
{ } Raw JSON

bundles / IPython 9.11.0 / IPython / core / display / Video / __init__

function

IPython.core.display:Video.__init__

source: /IPython/core/display.py :1140

Signature

def   __init__ ( self data = None url = None filename = None embed = False mimetype = None width = None height = None html_attributes = controls )

Summary

Create a video object given raw data or an URL.

Extended Summary

When this object is returned by an input cell or passed to the display function, it will result in the video being displayed in the frontend.

Parameters

data : unicode, str or bytes

The raw video data or a URL or filename to load the data from. Raw data will require passing embed=True.

url : unicode

A URL for the video. If you specify url=, the image data will not be embedded.

filename : unicode

Path to a local file containing the video. Will be interpreted as a local URL unless embed=True.

embed : bool

Should the video be embedded using a data URI (True) or be loaded using a <video> tag (False).

Since videos are large, embedding them should be avoided, if possible. You must confirm embedding as your intention by passing embed=True.

Local files can be displayed with URLs without embedding the content, via

Video('./video.mp4')
mimetype : unicode

Specify the mimetype for embedded videos. Default will be guessed from file extension, if available.

width : int

Width in pixels to which to constrain the video in HTML. If not supplied, defaults to the width of the video.

height : int

Height in pixels to which to constrain the video in html. If not supplied, defaults to the height of the video.

html_attributes : str

Attributes for the HTML <video> block. Default: "controls" to get video controls. Other examples: "controls muted" for muted video with controls, "loop autoplay" for looping autoplaying video without controls.

Examples

:: Video('https://archive.org/download/Sita_Sings_the_Blues/Sita_Sings_the_Blues_small.mp4') Video('path/to/video.mp4') Video('path/to/video.mp4', embed=True) Video('path/to/video.mp4', embed=True, html_attributes="controls muted autoplay") Video(b'raw-videodata', embed=True)

Aliases

  • IPython.display.Video.__init__