📌  相关文章
📜  使用 jquery 创建视频播放列表 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:26.650000             🧑  作者: Mango

代码示例1
function handler(e) {
    e.preventDefault();
    videotarget = this.getAttribute("href");
    filename = videotarget.substr(0, videotarget.lastIndexOf('.')) || videotarget;
    video = document.querySelector("#video_player video");
    video.removeAttribute("controls");
    video.removeAttribute("poster");
    source = document.querySelectorAll("#video_player video source");
    source[0].src = filename + ".mp4";
    source[1].src = filename + ".webm";
    video.load();
    video.play();    
}