JSFiddle - React, Tailwind, and code Playground

by himel023

JavaScript

var video = document.getElementById("video");
var videoFormat = this.getVideoFormat();

if (
    this.props.videoDataRow.vcodec === "H264" ||
    this.props.videoDataRow.vcodec === ""
) {
    if (videoFormat === "mpd") {
        this.handleMpdVideo();
    } else if (videoFormat === "m3u8") {
        this.handleM3u8Video();
    } else {
        console.log("Not supported video format");
    }
} else if (this.props.videoDataRow.vcodec === "H265") {

    if (video.canPlayType(`video/mp4;codecs=${"hev1"}`) === "probably" ||
        video.canPlayType(`video/mp4;codecs=${"hev1"}`) === "maybe"
    ) {
        if (videoFormat === "mpd") {
            this.handleMpdVideo();
        } else if (videoFormat === "m3u8") {
            this.handleM3u8Video();
        } else {
            console.log("Not supported video format");
        }
    } else {
        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."
        });
    }
}