## 点击播放暂停一体化
**HTML**
<button onclick="playPause()" id="button1">播放</button>
**js获取**
var myVideo=document.getElementById("video1");
function playPause()
{
var button1=document.getElementById("button1")
if (myVideo.paused) {
myVideo.play();
button1.innerHTML="暂停";
}
else {
myVideo.pause();
button1.innerHTML="播放";
}
}
```**文件导入js获取**
function chang1(){
var D_file=document.getElementById('D_file');
D_file.click();
}
function play(){
var file = document.getElementById('D_file').files[0];
var url = URL.createObjectURL(file);
console.log(url);
document.getElementById("video_id").src = url;
}
var image = '';
function selectImage(file) {
if (!file.files || !file.files[0]) {
return;
}
var reader = new FileReader();
reader.onload = function (evt) {
document.getElementById('video1').src = evt.target.result;
image = evt.target.result;
}
reader.readAsDataURL(file.files[0]);
}