MCPcopy Create free account
hub / github.com/ipython/ipython / __init__

Method __init__

IPython/core/display.py:1331–1410  ·  view source on GitHub ↗

Create a video object given raw data or an URL. 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

(self, data=None, url=None, filename=None, embed=False,
                 mimetype=None, width=None, height=None, html_attributes="controls")

Source from the content-addressed store, hash-verified

1329class Video(DisplayObject):
1330
1331 def __init__(self, data=None, url=None, filename=None, embed=False,
1332 mimetype=None, width=None, height=None, html_attributes="controls"):
1333 """Create a video object given raw data or an URL.
1334
1335 When this object is returned by an input cell or passed to the
1336 display function, it will result in the video being displayed
1337 in the frontend.
1338
1339 Parameters
1340 ----------
1341 data : unicode, str or bytes
1342 The raw video data or a URL or filename to load the data from.
1343 Raw data will require passing `embed=True`.
1344 url : unicode
1345 A URL for the video. If you specify `url=`,
1346 the image data will not be embedded.
1347 filename : unicode
1348 Path to a local file containing the video.
1349 Will be interpreted as a local URL unless `embed=True`.
1350 embed : bool
1351 Should the video be embedded using a data URI (True) or be
1352 loaded using a <video> tag (False).
1353
1354 Since videos are large, embedding them should be avoided, if possible.
1355 You must confirm embedding as your intention by passing `embed=True`.
1356
1357 Local files can be displayed with URLs without embedding the content, via::
1358
1359 Video('./video.mp4')
1360
1361 mimetype: unicode
1362 Specify the mimetype for embedded videos.
1363 Default will be guessed from file extension, if available.
1364 width : int
1365 Width in pixels to which to constrain the video in HTML.
1366 If not supplied, defaults to the width of the video.
1367 height : int
1368 Height in pixels to which to constrain the video in html.
1369 If not supplied, defaults to the height of the video.
1370 html_attributes : str
1371 Attributes for the HTML `<video>` block.
1372 Default: `"controls"` to get video controls.
1373 Other examples: `"controls muted"` for muted video with controls,
1374 `"loop autoplay"` for looping autoplaying video without controls.
1375
1376 Examples
1377 --------
1378
1379 ::
1380
1381 Video('https://archive.org/download/Sita_Sings_the_Blues/Sita_Sings_the_Blues_small.mp4')
1382 Video('path/to/video.mp4')
1383 Video('path/to/video.mp4', embed=True)
1384 Video('path/to/video.mp4', embed=True, html_attributes="controls muted autoplay")
1385 Video(b'raw-videodata', embed=True)
1386 """
1387 if isinstance(data, (Path, PurePath)):
1388 data = str(data)

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected