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);
});
}
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.