parameters: (video_file: str, height: int = 400)
docstring: Displays a video both locally and in a notebook. Will display the video
      as an HTML5 video if in a notebook, otherwise it opens the video file using
      the default system viewer.
  
      :param video_file: the filename of the video to display
      :param height: the height to display the video in a notebook.
docstring_summary: Displays a video both locally and in a notebook. Will display the video
      as an HTML5 video if in a notebook, otherwise it opens the video file using
      the default system viewer.
docstring_tokens: Displays a video both locally and in a notebook . Will display the video as an HTML5 video if in a notebook otherwise it opens the video file using the default system viewer .
function: def display_video(video_file: str, height: int = 400):
      """Displays a video both locally and in a notebook. Will display the video
      as an HTML5 video if in a notebook, otherwise it opens the video file using
      the default system viewer.
  
      :param video_file: the filename of the video to display
      :param height: the height to display the video in a notebook.
      """
      # Check if in notebook
      if is_notebook():
          from IPython import display as ipythondisplay
          from IPython.display import HTML
  
          ext = os.path.splitext(video_file)[-1][1:]
          video = io.open(video_file, "r+b").read()
          ipythondisplay.display(
              HTML(
                  data="""<video alt="test" autoplay
            loop controls style="height: {2}px;">
            <source src="data:video/{1}';base64,{0}" type="video/{1}" />
            </video>""".format(
                      base64.b64encode(video).decode("ascii"), ext, height
                  )
              )
          )
      else:
          if sys.platform == "win32":
              os.startfile(video_file)  # type: ignore[attr-defined]
          else:
              opener = "open" if sys.platform == "darwin" else "xdg-open"
              subprocess.call([opener, video_file])
function_tokens: def display_video ( video_file : str , height : int = 400 ) : # Check if in notebook if is_notebook ( ) : from IPython import display as ipythondisplay from IPython . display import HTML ext = os . path . splitext ( video_file ) [ - 1 ] [ 1 : ] video = io . open ( video_file , "r+b" ) . read ( ) ipythondisplay . display ( HTML ( data = """<video alt="test" autoplay
            loop controls style="height: {2}px;">
            <source src="data:video/{1}';base64,{0}" type="video/{1}" />
            </video>""" . format ( base64 . b64encode ( video ) . decode ( "ascii" ) , ext , height ) ) ) else : if sys . platform == "win32" : os . startfile ( video_file ) # type: ignore[attr-defined] else : opener = "open" if sys . platform == "darwin" else "xdg-open" subprocess . call ( [ opener , video_file ] )