Video#
Open this notebook in Jupyterlite | Download this notebook from GitHub (right-click to download).
import panel as pn
pn.extension()
The Video
Pane displays a video player given a local or remote video file. The widget also allows access and control over the player state including toggling of playing/paused
and loop
state, the current time
, and the volume
. Depending on the browser the video player supports mp4
, webm
, and ogg
containers and a variety of codecs.
Parameters:#
For details on other options for customizing the component see the layout and styling how-to guides.
name
(str): The title of the widgetloop
(boolean): Whether to loop when reaching the end of playbackobject
(string): Local file path or remote URL pointing to audio filepaused
(boolean): Whether the player is pausedautoplay
(boolean): When True, it specifies that the output will play automatically. In Chromium browsers this requires the user to click play oncemuted
(boolean): When True, it specifies that the output should be mutedthrottle
(int): How frequently to sample the current playback time in millisecondstime
(float): Current playback time in secondsvolume
(int): Volume in the range 0-100
The Video
Pane can be constructed with a URL pointing to a remote video file or a local video file (in which case the data is embedded).
video = pn.pane.Video('https://assets.holoviz.org/panel/samples/video_sample.mp4', width=640, loop=True)
video
The player can be controlled using its own widgets, as well as by using Python code as follows. To pause or unpause it in code, use the paused
property:
#video.paused = False
The current player time
can be read and set with the time variable (in seconds):
video.time
The volume
may also be read and set:
video.volume = 50
Controls#
The Video
pane exposes a number of options which can be changed from both Python and Javascript try out the effect of these parameters interactively:
pn.Row(video.controls(jslink=True), video)
Open this notebook in Jupyterlite | Download this notebook from GitHub (right-click to download).