changing source on html5 video tag

前端 未结 16 1851
既然无缘
既然无缘 2020-11-22 08:31

i\'m trying to build a video player, that works everywhere. so far i\'d be going with:

16条回答
  •  花落未央
    2020-11-22 09:29

    Another way you can do in Jquery.

    HTML

    
    
    
    

    Jquery

    $(".list-item").find(".item").on("click", function() {
            let videoData = $(this).data("video");
            let videoSource = $("#videoclip").find("#mp4video");
            videoSource.attr("src", videoData);
            let autoplayVideo = $("#videoclip").get(0);
            autoplayVideo.load();
            autoplayVideo.play();
        });
    

提交回复
热议问题