小编use*_*224的帖子

在另一个视频中运行绿屏视频

我想问为什么我不能在这个画布中运行两个不同的视频源,即.ogg和.mp4文件.我试图将此绿屏视频覆盖到另一个隐藏了背景颜色的视频.

<html>
  <head>
    <script type = "text/javascript">
      function load() {
        var get1 = document.getElementById("c1");
        var set1 = get1.getContext("2d");

        var get2 = document.getElementById("c2");
        var set2 = get2.getContext("2d");

        var video1 = document.getElementById("video1");
        var video2 = document.getElementById("video2");

        video1.addEventListener('play', function(){runVideo();});
        video2.addEventListener('play', function(){runVideo2();});

        var runVideo1 = function() {
          if(video1.paused || video1.ended) {
            return;
          }

          var frameconversion = function() {
            if(window.requestAnimationFrame) {
              requestAnimationFrame(runVideo1);
            } else {
              setTimeout(runVideo,0);
            }
          };
        };

        var runVideo2 = function() {
          if(video2.paused || video2.ended) {
            return;
          }

          var frameconversion2 = function() { …
Run Code Online (Sandbox Code Playgroud)

video html5 canvas

7
推荐指数
1
解决办法
983
查看次数

标签 统计

canvas ×1

html5 ×1

video ×1