当项目单击它时将调用showvideo function:
showVideo(vidSrc, vidWidth, jwSrc, itemId) {
console.log(jwSrc);
this.hideVideo = false;
this.show_backdrop();
document.getElementById("video_wrapper").style.marginLeft = (-1 * vidWidth / 2) + "px";
if (this.isIE) {
if (this.player) {
this.player.remove();
}
this.player = jwplayer("video_wrapper").setup({
file: jwSrc,
width: vidWidth,
aspectratio: '16:9',
type: 'mp4'
});
} else {
console.log("not ie show video");
let vid = <HTMLVideoElement>document.getElementById("video");
this.videoSrc = vidSrc;
this.videoWidth = vidWidth;
vid.load();
setTimeout(function () {
vid.play();
}, 1000);
}
}
下面的html代码: