html canvas绘制视频

2020-05-09 17:07:10 浏览数 (1)

canvas绘制视频

代码语言:javascript复制
<html>
  <head>
    <style>
      body {
        background: black;
        color:#CCCCCC; 
      }
      #c2 {
        background-image: url(test.png);
        background-repeat: no-repeat;
      }
      div {
        float: left;
        border :1px solid #444444;
        padding:10px;
        margin: 10px;
        background:#3B3B3B;
      }
    </style>
    <script type="text/javascript">
        function p(){
            this.doLoad = function doLoad() {
            this.video = document.getElementById('video');
            this.c1 = document.getElementById('c1');
            this.ctx1 = this.c1.getContext('2d');
            this.c2 = document.getElementById('c2');
            this.ctx2 = this.c2.getContext('2d');
            let self = this;
            this.video.addEventListener('play', function() {
                self.width = self.video.videoWidth / 2;
                self.height = self.video.vi

0 人点赞