Before video.js, is terminated, the instance is reinitialized and cannot be initialized.

before I destroy the instance in demo, the instance is reinitialized, which is ok:

var handler = function () {
    alert(12111);
}
var handler1 = function () {
    alert(22222);
}
var player;
play(handler);
function play(handler) {
    videojs("example_video_1",
        {
            "techOrder": ["html5", "flash"],
            fluid: true,
            "controls": true,
            "bigPlayButton": false,
            flash: {
                swf: "js/swf/video-js.swf"
            },
            controlBar: {
                muteToggle: false,
                captionsButton: false,
                chaptersButton: false,
                playbackRateMenuButton: false,
                LiveDisplay: false,
                subtitlesButton: false,
                remainingTimeDisplay: false,
                progressControl: false,
                volumeMenuButton: {
                    inline: false,
                    vertical: true
                },//
                fullscreenToggle: false
            }
        }
        , function () {
            var id = $("-sharpexample_video_1").find("video")[0].id;
            player = this;
            player.src("http://180.97.83.70:30220/media/adinfo/2018/05/1920x1080_1.mp4");
            player.play();
            $("-sharpexample_video_1").find("button").show();
            console.log(player.duration())
            this.on("loadeddata", handler);
            this.on("ended", function () {
                this.pause();
            })
        });
}
setTimeout(function () {
    player.dispose();
    $("-sharpbt").before("<video id="example_video_1" class="video-js vjs-default-skin" controls width="640" height="264"></video>")
    play(handler1);
}, 3000);

:
//video.js video
    function playWithVideoJs(handler,url) {
        var divFirst = $("-sharpNER_EshowadvImgAdv_ad").parent().find("div")[0];
        if (notNull(divFirst) && divFirst.id == "NER_EshowadvVideoAdv_ad") {
            $("-sharpNER_EshowadvImgAdv_ad").parent().find("div")[0].remove();
            $("-sharpNER_EshowadvImgAdv_ad").after("<video id="NER_EshowadvVideoAdv_ad" controls class="video-js vjs-default-skin vjs-big-play-centered vjs-fluid"></video>");
        }
        if (notNull(myPlayer1)) {
            myPlayer1.dispose();
        }
        videojs("NER_EshowadvVideoAdv_ad", {
            "techOrder": ["html5", "flash"],
            fluid: true,
            example_option: true,
            // "controls": false,
            "bigPlayButton": false,
            flash: {
                swf: "js/swf/video-js.swf"
            },
            controlBar: {
                muteToggle: false,
                captionsButton: false,
                chaptersButton: false,
                playbackRateMenuButton: false,
                LiveDisplay: false,
                subtitlesButton: false,
                remainingTimeDisplay: false,
                progressControl: false,
                volumeMenuButton: {
                    inline: true,
                    vertical: false
                },//
                fullscreenToggle: false
            }
        }, function () {
            myPlayer1 = this;
            var videoID = $("-sharpNER_EshowadvVideoAdv_ad").find("video")[0].id;
            $("-sharp" + videoID).prop("src", url);
            // $("-sharpNER_EshowadvVideoAdv_ad").find("button").off("click").on("click", function () {
            $("-sharpNER_EshowadvVideoAdv_ad").find("video")[0].play();
            // });
            //--
            this.on("loadedmetadata", handler);
        });
    }

clipboard.png

clipboard.png

clipboard.png

what kind of problem is this? For the first time, use video.js, to get down on your knees and ask for advice. Thank you.


your destruction should have removed the video tag


I don't know if the landlord has solved it. Destruction does remove the video tag, but after the first reinitialization, you can see whether the content in the video tag is the same as initializing with js. Using videojs during page loading will add a lot of elements to video. Initialization using js seems to be different

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2bd63-2bae0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2bd63-2bae0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?