SOURCE

console 命令行工具 X clear

                    
>
console
let videoSrc = document.getElementById("video-src");
let myVideoDom = document.getElementById("myVideo");
let testBtn = document.getElementById('test');
let playBtn = document.getElementById('play');
let pauseBtn = document.getElementById("pause");
let bg_video = document.getElementById("bg-video");
testBtn.onclick = () => {
    myVideoDom.src = videoSrc.value;
    myVideoDom.play();
}

let interId;
playBtn.onclick = () => {
    interId = setInterval(() => {
        bg_video.style.backgroundColor = "#"+((1<<24)*Math.random()|0).toString(16);
    }, 100);
    myVideoDom.play();
}

pauseBtn.onclick = () => {
 myVideoDom.pause();
}
<div id="bg-video">
    <video src="https://cdn.jsdelivr.net/gh/shanyutongxue/cdnCache/example2.mp4" width ="640" height="360" id="myVideo">
</div>
<div>
    测试video:<input id="video-src">
    <button id="test">测试</button>
    <button id="play">播放</button>
    <button id="pause">暂停</button>
</div>
html {
    font-family: monospace;
    color: #333;
    /* background-color: black; */
  }
  #current {
    font-size: 12px;
  }
  #canvas {
    width: 640px;
    height: 360px;
  }
  #canvas2 {
    width: 640px;
    height: 360px;
    position: absolute;
    left: 0px;
    top: 0px;
    z-index: 10;
  }
  #container {
    position: relative;
  }

  button {
    line-height: 1.499;
      position: relative;
      display: inline-block;
      font-weight: 400;
      white-space: nowrap;
      text-align: center;
      background-image: none;
      border: 1px solid transparent;
      cursor: pointer;
      user-select: none;
      height: 32px;
      padding: 0 15px;
      font-size: 14px;
      border-radius: 4px;
      color: rgba(0,0,0,0.65);
      background-color: #fff;
      border-color: #d9d9d9;
      outline: 0;
      transition: all .3s cubic-bezier(.645, .045, .355, 1);
  }

  button:hover {
    color: #40a9ff;
    background-color: #fff;
    border-color: #40a9ff;
  }

  button:active {
    color: #096dd9;
    background-color: #fff;
    border-color: #096dd9;
  }

  input[type="text"] {
    -webkit-appearance: none;
    background-color: #fff;
    background-image: none;
    border-radius: 4px;
    border: 1px solid #dcdfe6;
    box-sizing: border-box;
    color: #606266;
    display: inline-block;
    font-size: inherit;
    height: 32px;
    line-height: 32px;
    outline: none;
    padding: 0 8px;
    transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
    width: 50px;
  }

  .wrapper {
    width: 640px;
    height: 360px;
    position: relative;
  }

@font-face {
  font-family: "hardFont";
  src: url('./../../assets/hardFont.ttf');
}
#bg-video{
    width:640px;
    height:400px;
}
#changeSrc{
    width:80%;
    height:40px;
    line-height: 40px;
}