Skip to content

Video Player

A video player component that can play various video formats.

Use your app's static folder to serve videos directly. For example, static/my_video.mp4.

Alternatively, you can pack bytes or files in state:

state["vid_b"] = ss.pack_bytes(vid_bytes, "video/mp4")

state["vid_f"] = ss.pack_file(vid_file, "video/mp4")

Afterwards, you can reference the video using the syntax @{vid_f}.

Fields

NameTypeDescriptionOptions
SourceTextThe URL of the video file. Alternatively, you can pass a file via state.
ControlsTextDisplay video player controls.
  • Yes
  • No
AutoplayTextAutoplay the video when the component is loaded.
  • Yes
  • No
LoopTextLoop the video when it reaches the end.
  • Yes
  • No
MutedTextMute the video by default.
  • Yes
  • No
Custom CSS classesTextCSS classes, separated by spaces. You can define classes in custom stylesheets.

Low code usage

This component can be declared directly in Python, using backend-driven UI.

python
ui.VideoPlayer(content={
        "src": "", # str 
        "controls": "yes", # str [yes, no]
        "autoplay": "no", # str [yes, no]
        "loop": "no", # str [yes, no]
        "muted": "no", # str [yes, no]
        "cssClasses": "", # str 
    }
)

Reference