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"] = wf.pack_bytes(vid_bytes, "video/mp4")

state["vid_f"] = wf.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.
    1. Yes
    2. No
    AutoplayTextAutoplay the video when the component is loaded.
    1. Yes
    2. No
    LoopTextLoop the video when it reaches the end.
    1. Yes
    2. No
    MutedTextMute the video by default.
    1. Yes
    2. 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.

      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