JSFiddle - React, Tailwind, and code Playground

by himel023

JavaScript

if (
      this.props.videoDataRow.vcodec === "H264" ||
      this.props.videoDataRow.vcodec === ""
    ) {
      //vcodec is ok
      //cheking if incoming video format is m3u8 or mpd or other

    } else if (this.props.videoDataRow.vcodec === "H265") {
      //checking if H265 video playable or not. Microsoft edge browser with
      //HEVC Video extensions can play. (.mpd playable for now, not .m3u8)
      //if vcodec is ok, then play-
      //checking if videocodec H265 is playable in the browser
      if (
        video.canPlayType(`video/mp4;codecs=${"hev1"}`) === "probably" ||
        video.canPlayType(`video/mp4;codecs=${"hev1"}`) === "maybe"
      ) {
        //cheking if incoming video format is m3u8 or mpd or other
        if (videoFormat === "mpd") {
          this.handleMpdVideo();
        } else if (videoFormat === "m3u8") {
          this.handleM3u8Video();
        } else {
          console.log("Not supported video format");
        }
      } else {
        // error message
        this.setState({
          codecNotSupMsg:
            "H265 video codec not supported by this browser. To play this video, Please open Microsoft Edge browser and install HEVC video extension from Microsoft store."
        });
      }
    }