第1个回答 2016-01-12
<div class="content">
<input id="v_file" type="file" style="display:none;" onChange="play()"/>
<button id="play" onClick="yincang()">播放</button>
<video id="video_id" controls autoplay></video>
</div>
<script>
function yincang(){
var v_file=document.getElementById('v_file');
v_file.click();
}
function play(){
var file = document.getElementById('v_file').files[0];
var url = URL.createObjectURL(file);
console.log(url);
document.getElementById("video_id").src = url;
}
</script>