HTML video 播放本地視訊

weixin_34249678發表於2017-07-06
<input id="v_file" type="file" onChange="play()"/>
<video id="myVideo" loop="loop"  autoplay="autoplay">
          <source src="" type="video/mp4">
</video>  
function play(){
    var file = document.getElementById('v_file').files[0];
        var url = URL.createObjectURL(file);
        console.log(url);
        document.getElementById("myVideo").src = url;
    $("#v_file").hide();
}

相關文章