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")
| 1137 | class Video(DisplayObject): |
| 1138 | |
| 1139 | def __init__(self, data=None, url=None, filename=None, embed=False, |
| 1140 | mimetype=None, width=None, height=None, html_attributes="controls"): |
| 1141 | """Create a video object given raw data or an URL. |
| 1142 | |
| 1143 | When this object is returned by an input cell or passed to the |
| 1144 | display function, it will result in the video being displayed |
| 1145 | in the frontend. |
| 1146 | |
| 1147 | Parameters |
| 1148 | ---------- |
| 1149 | data : unicode, str or bytes |
| 1150 | The raw video data or a URL or filename to load the data from. |
| 1151 | Raw data will require passing ``embed=True``. |
| 1152 | |
| 1153 | url : unicode |
| 1154 | A URL for the video. If you specify ``url=``, |
| 1155 | the image data will not be embedded. |
| 1156 | |
| 1157 | filename : unicode |
| 1158 | Path to a local file containing the video. |
| 1159 | Will be interpreted as a local URL unless ``embed=True``. |
| 1160 | |
| 1161 | embed : bool |
| 1162 | Should the video be embedded using a data URI (True) or be |
| 1163 | loaded using a <video> tag (False). |
| 1164 | |
| 1165 | Since videos are large, embedding them should be avoided, if possible. |
| 1166 | You must confirm embedding as your intention by passing ``embed=True``. |
| 1167 | |
| 1168 | Local files can be displayed with URLs without embedding the content, via:: |
| 1169 | |
| 1170 | Video('./video.mp4') |
| 1171 | |
| 1172 | mimetype : unicode |
| 1173 | Specify the mimetype for embedded videos. |
| 1174 | Default will be guessed from file extension, if available. |
| 1175 | |
| 1176 | width : int |
| 1177 | Width in pixels to which to constrain the video in HTML. |
| 1178 | If not supplied, defaults to the width of the video. |
| 1179 | |
| 1180 | height : int |
| 1181 | Height in pixels to which to constrain the video in html. |
| 1182 | If not supplied, defaults to the height of the video. |
| 1183 | |
| 1184 | html_attributes : str |
| 1185 | Attributes for the HTML ``<video>`` block. |
| 1186 | Default: ``"controls"`` to get video controls. |
| 1187 | Other examples: ``"controls muted"`` for muted video with controls, |
| 1188 | ``"loop autoplay"`` for looping autoplaying video without controls. |
| 1189 | |
| 1190 | Examples |
| 1191 | -------- |
| 1192 | :: |
| 1193 | |
| 1194 | Video('https://archive.org/download/Sita_Sings_the_Blues/Sita_Sings_the_Blues_small.mp4') |
| 1195 | Video('path/to/video.mp4') |
| 1196 | Video('path/to/video.mp4', embed=True) |