class_docstr: Creates a video component that can be used to upload/record videos (as an input) or display videos (as an output).
  For the video to be playable in the browser it must have a compatible container and codec combination. Allowed
  combinations are .mp4 with h264 codec, .ogg with theora codec, and .webm with vp9 codec. If the component detects
  that the output video would not be playable in the browser it will attempt to convert it to a playable mp4 video.
  If the conversion fails, the original video is returned.
  Preprocessing: passes the uploaded video as a {str} filepath or URL whose extension can be modified by `format`.
  Postprocessing: expects a {str} or {pathlib.Path} filepath to a video which is displayed, or a {Tuple[str | pathlib.Path, str | pathlib.Path | None]} where the first element is a filepath to a video and the second element is an optional filepath to a subtitle file.
  Examples-format: a {str} filepath to a local file that contains the video, or a {Tuple[str, str]} where the first element is a filepath to a video file and the second element is a filepath to a subtitle file.
  Demos: video_identity, video_subtitle
docstr: Parameters:
      value: A path or URL for the default value that Video component is going to take. Can also be a tuple consisting of (video filepath, subtitle filepath). If a subtitle file is provided, it should be of type .srt or .vtt. Or can be callable, in which case the function will be called whenever the app loads to set the initial value of the component.
      format: Format of video format to be returned by component, such as 'avi' or 'mp4'. Use 'mp4' to ensure browser playability. If set to None, video will keep uploaded format.
      sources: A list of sources permitted for video. "upload" creates a box where user can drop an video file, "webcam" allows user to record a video from their webcam. If None, defaults to ["upload, "webcam"].
      height: The height of the displayed video, specified in pixels if a number is passed, or in CSS units if a string is passed.
      width: The width of the displayed video, specified in pixels if a number is passed, or in CSS units if a string is passed.
      label: The label for this component. Appears above the component and is also used as the header if there are a table of examples for this component. If None and used in a `gr.Interface`, the label will be the name of the parameter this component is assigned to.
      every: If `value` is a callable, run the function 'every' number of seconds while the client connection is open. Has no effect otherwise. Queue must be enabled. The event can be accessed (e.g. to cancel it) via this component's .load_event attribute.
      show_label: if True, will display label.
      container: If True, will place the component in a container - providing some extra padding around the border.
      scale: relative width compared to adjacent Components in a Row. For example, if Component A has scale=2, and Component B has scale=1, A will be twice as wide as B. Should be an integer.
      min_width: minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.
      interactive: if True, will allow users to upload a video; if False, can only be used to display videos. If not provided, this is inferred based on whether the component is used as an input or output.
      visible: If False, component will be hidden.
      elem_id: An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
      elem_classes: An optional list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles.
      render: If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.
      mirror_webcam: If True webcam will be mirrored. Default is True.
      include_audio: Whether the component should record/retain the audio track for a video. By default, audio is excluded for webcam videos and included for uploaded videos.
      autoplay: Whether to automatically play the video when the component is used as an output. Note: browsers will not autoplay video files if the user has not interacted with the page yet.
      show_share_button: If True, will show a share icon in the corner of the component that allows user to share outputs to Hugging Face Spaces Discussions. If False, icon does not appear. If set to None (default behavior), then the icon appears if this Gradio app is launched on Spaces, but not otherwise.
      min_length: The minimum length of video (in seconds) that the user can pass into the prediction function. If None, there is no minimum length.
      max_length: The maximum length of video (in seconds) that the user can pass into the prediction function. If None, there is no maximum length.
docstr_tok: ["Parameters",":","value",":","A","path","or","URL","for","the","default","value","that","Video","component","is","going","to","take",".","Can","also","be","a","tuple","consisting","of","(","video","filepath",",","subtitle","filepath",")",".","If","a","subtitle","file","is","provided",",","it","should","be","of","type",".srt","or",".vtt",".","Or","can","be","callable",",","in","which","case","the","function","will","be","called","whenever","the","app","loads","to","set","the","initial","value","of","the","component",".","format",":","Format","of","video","format","to","be","returned","by","component",",","such","as","'avi","'","or","'mp4","'",".","Use","'mp4","'","to","ensure","browser","playability",".","If","set","to","None",",","video","will","keep","uploaded","format",".","sources",":","A","list","of","sources","permitted","for","video",".","``","upload","''","creates","a","box","where","user","can","drop","an","video","file",",","``","webcam","''","allows","user","to","record","a","video","from","their","webcam",".","If","None",",","defaults","to","[","``","upload",",","``","webcam","''","]",".","height",":","The","height","of","the","displayed","video",",","specified","in","pixels","if","a","number","is","passed",",","or","in","CSS","units","if","a","string","is","passed",".","width",":","The","width","of","the","displayed","video",",","specified","in","pixels","if","a","number","is","passed",",","or","in","CSS","units","if","a","string","is","passed",".","label",":","The","label","for","this","component",".","Appears","above","the","component","and","is","also","used","as","the","header","if","there","are","a","table","of","examples","for","this","component",".","If","None","and","used","in","a","`","gr.Interface","`",",","the","label","will","be","the","name","of","the","parameter","this","component","is","assigned","to",".","every",":","If","`","value","`","is","a","callable",",","run","the","function","'every","'","number","of","seconds","while","the","client","connection","is","open",".","Has","no","effect","otherwise",".","Queue","must","be","enabled",".","The","event","can","be","accessed","(","e.g",".","to","cancel","it",")","via","this","component","'s",".load_event","attribute",".","show_label",":","if","True",",","will","display","label",".","container",":","If","True",",","will","place","the","component","in","a","container","-","providing","some","extra","padding","around","the","border",".","scale",":","relative","width","compared","to","adjacent","Components","in","a","Row",".","For","example",",","if","Component","A","has","scale=2",",","and","Component","B","has","scale=1",",","A","will","be","twice","as","wide","as","B",".","Should","be","an","integer",".","min_width",":","minimum","pixel","width",",","will","wrap","if","not","sufficient","screen","space","to","satisfy","this","value",".","If","a","certain","scale","value","results","in","this","Component","being","narrower","than","min_width",",","the","min_width","parameter","will","be","respected","first",".","interactive",":","if","True",",","will","allow","users","to","upload","a","video",";","if","False",",","can","only","be","used","to","display","videos",".","If","not","provided",",","this","is","inferred","based","on","whether","the","component","is","used","as","an","input","or","output",".","visible",":","If","False",",","component","will","be","hidden",".","elem_id",":","An","optional","string","that","is","assigned","as","the","id","of","this","component","in","the","HTML","DOM",".","Can","be","used","for","targeting","CSS","styles",".","elem_classes",":","An","optional","list","of","strings","that","are","assigned","as","the","classes","of","this","component","in","the","HTML","DOM",".","Can","be","used","for","targeting","CSS","styles",".","render",":","If","False",",","component","will","not","render","be","rendered","in","the","Blocks","context",".","Should","be","used","if","the","intention","is","to","assign","event","listeners","now","but","render","the","component","later",".","mirror_webcam",":","If","True","webcam","will","be","mirrored",".","Default","is","True",".","include_audio",":","Whether","the","component","should","record\/retain","the","audio","track","for","a","video",".","By","default",",","audio","is","excluded","for","webcam","videos","and","included","for","uploaded","videos",".","autoplay",":","Whether","to","automatically","play","the","video","when","the","component","is","used","as","an","output",".","Note",":","browsers","will","not","autoplay","video","files","if","the","user","has","not","interacted","with","the","page","yet",".","show_share_button",":","If","True",",","will","show","a","share","icon","in","the","corner","of","the","component","that","allows","user","to","share","outputs","to","Hugging","Face","Spaces","Discussions",".","If","False",",","icon","does","not","appear",".","If","set","to","None","(","default","behavior",")",",","then","the","icon","appears","if","this","Gradio","app","is","launched","on","Spaces",",","but","not","otherwise",".","min_length",":","The","minimum","length","of","video","(","in","seconds",")","that","the","user","can","pass","into","the","prediction","function",".","If","None",",","there","is","no","minimum","length",".","max_length",":","The","maximum","length","of","video","(","in","seconds",")","that","the","user","can","pass","into","the","prediction","function",".","If","None",",","there","is","no","maximum","length","."]
code: def __init__(
      self,
      value: str
      | Path
      | tuple[str | Path, str | Path | None]
      | Callable
      | None = None,
      *,
      format: str | None = None,
      sources: list[Literal["upload", "webcam"]] | None = None,
      height: int | str | None = None,
      width: int | str | None = None,
      label: str | None = None,
      every: float | None = None,
      show_label: bool | None = None,
      container: bool = True,
      scale: int | None = None,
      min_width: int = 160,
      interactive: bool | None = None,
      visible: bool = True,
      elem_id: str | None = None,
      elem_classes: list[str] | str | None = None,
      render: bool = True,
      mirror_webcam: bool = True,
      include_audio: bool | None = None,
      autoplay: bool = False,
      show_share_button: bool | None = None,
      min_length: int | None = None,
      max_length: int | None = None,
  ):
      """
      Parameters:
          value: A path or URL for the default value that Video component is going to take. Can also be a tuple consisting of (video filepath, subtitle filepath). If a subtitle file is provided, it should be of type .srt or .vtt. Or can be callable, in which case the function will be called whenever the app loads to set the initial value of the component.
          format: Format of video format to be returned by component, such as 'avi' or 'mp4'. Use 'mp4' to ensure browser playability. If set to None, video will keep uploaded format.
          sources: A list of sources permitted for video. "upload" creates a box where user can drop an video file, "webcam" allows user to record a video from their webcam. If None, defaults to ["upload, "webcam"].
          height: The height of the displayed video, specified in pixels if a number is passed, or in CSS units if a string is passed.
          width: The width of the displayed video, specified in pixels if a number is passed, or in CSS units if a string is passed.
          label: The label for this component. Appears above the component and is also used as the header if there are a table of examples for this component. If None and used in a `gr.Interface`, the label will be the name of the parameter this component is assigned to.
          every: If `value` is a callable, run the function 'every' number of seconds while the client connection is open. Has no effect otherwise. Queue must be enabled. The event can be accessed (e.g. to cancel it) via this component's .load_event attribute.
          show_label: if True, will display label.
          container: If True, will place the component in a container - providing some extra padding around the border.
          scale: relative width compared to adjacent Components in a Row. For example, if Component A has scale=2, and Component B has scale=1, A will be twice as wide as B. Should be an integer.
          min_width: minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.
          interactive: if True, will allow users to upload a video; if False, can only be used to display videos. If not provided, this is inferred based on whether the component is used as an input or output.
          visible: If False, component will be hidden.
          elem_id: An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
          elem_classes: An optional list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles.
          render: If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.
          mirror_webcam: If True webcam will be mirrored. Default is True.
          include_audio: Whether the component should record/retain the audio track for a video. By default, audio is excluded for webcam videos and included for uploaded videos.
          autoplay: Whether to automatically play the video when the component is used as an output. Note: browsers will not autoplay video files if the user has not interacted with the page yet.
          show_share_button: If True, will show a share icon in the corner of the component that allows user to share outputs to Hugging Face Spaces Discussions. If False, icon does not appear. If set to None (default behavior), then the icon appears if this Gradio app is launched on Spaces, but not otherwise.
          min_length: The minimum length of video (in seconds) that the user can pass into the prediction function. If None, there is no minimum length.
          max_length: The maximum length of video (in seconds) that the user can pass into the prediction function. If None, there is no maximum length.
      """
      valid_sources: list[Literal["upload", "webcam"]] = [
          "upload",
          "webcam",
      ]
      if sources is None:
          self.sources = valid_sources
      elif isinstance(sources, str) and sources in valid_sources:
          self.sources = [sources]
      elif isinstance(sources, list):
          self.sources = sources
      else:
          raise ValueError(
              f"`sources` must be a list consisting of elements in {valid_sources}"
          )
      for source in self.sources:
          if source not in valid_sources:
              raise ValueError(
                  f"`sources` must a list consisting of elements in {valid_sources}"
              )
      self.format = format
      self.autoplay = autoplay
      self.height = height
      self.width = width
      self.mirror_webcam = mirror_webcam
      self.include_audio = (
          include_audio
          if include_audio is not None
          else "upload" in self.sources
      )
      self.show_share_button = (
          (utils.get_space() is not None)
          if show_share_button is None
          else show_share_button
      )
      self.min_length = min_length
      self.max_length = max_length
      super().__init__(
          label=label,
          every=every,
          show_label=show_label,
          container=container,
          scale=scale,
          min_width=min_width,
          interactive=interactive,
          visible=visible,
          elem_id=elem_id,
          elem_classes=elem_classes,
          render=render,
          value=value,
      )
  
imports: from __future__ import annotations
  import tempfile
  import warnings
  from pathlib import Path
  from typing import Any, Callable, Literal, Optional
  from gradio_client import utils
  from gradio_client.documentation import document, set_documentation_group
  import gradio
  from gradio import processing_utils, utils, wasm_utils
  from gradio.components.base import Component
  from gradio.data_classes import FileData, GradioModel
  from gradio.events import Events
label_desc: Use image node_id 1 to create a new Video object from inherited base classes: Component with example: obj = Video(value)