1.html和javascript混合代码:本地直接打开即可。
<!DOCTYPE html> <html> <head> <title>Local Video Player</title> </head> <body> <input type="file" id="inputVideo" accept="video/*"> <video id="myVideo" controls> <source id="videoSource" type="video/mp4"> </video> <script> const input = document.getElementById('inputVideo'); const video = document.getElementById('myVideo'); const source = document.getElementById('videoSource'); input.addEventListener('change', function(event) { const file = this.files[0]; const url = URL.createObjectURL(file); source.setAttribute('src', url); video.load(); }); </script> </body> </html>
标签:播放器,document,const,低配,getElementById,video,file,播放 From: https://www.cnblogs.com/eisenshu/p/17141993.html