SOURCE

console 命令行工具 X clear

                    
>
console
  let canvas = document.getElementById('canvas');
  let editor = new Editor(canvas);
  let visualCanvas = document.querySelector('.visualizer');
  let delayTime = document.querySelector('#delayTime');
  let volume = document.querySelector('#volume');
  var videoNode = editor.video("https://tosv.byted.org/obj/eden-internal/uhyuhybd/video-editor-resource/assets/test.mp4", {
    attributes: {
      volume: 0
    },
    playbackRate:1.5
  });
  videoNode.timelineStart(0);
  videoNode.timelineStop(20);
  videoNode.connect(editor.output);



  let audio1 = editor.audio('https://tosv.byted.org/obj/eden-internal/uhyuhybd/video-editor-resource/assets/test.mp4', {
    type: Editor.AUDIOEFFECT.FADE,
    useEffect: true,//音频缓冲区内应开始播放的时间的偏移量,需要使用音效的初始化的需要置true
    fade: {
      inTime: 2,//淡入淡出的时间长度
      outTime: 2
    }
  });
  audio1.timelineStart(0);
  audio1.timelineStop(20);
  audio1.playbackRate = 1.5;
  audio1._audioCtx.suspend();

  videoNode.on('onVideoPause', () => {
    audio1._audioCtx.suspend();
  });

  videoNode.on('onVideoPlay', () => {
    console.log('开始播放')
    audio1._audioCtx.resume();//5秒开始有效
  });

  var playButton = document.getElementById('play-button');
  var pauseButton = document.getElementById('pause-button');
  playButton.onclick = editor.play.bind(editor);
  pauseButton.onclick = editor.pause.bind(editor);
  InitVisualisations(editor, 'timeline-canvas', 'current');
<div class="wrapper">
    <canvas width="640" height="360" id="canvas"></canvas>
    <button id="play-button">play</button>
    <button id="pause-button">pause</button>
    <button id="changeTransition">change</button>
    <canvas class="visualizer" width="640" height="100"></canvas>
    <p id="current">
    <p>
      <canvas id="timeline-canvas" width="640" height="20"></canvas>
    </p>

    </p>
  </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;
  }

  html {
      font-family: monospace;
      color: #333;
    }

    #canvas {
      width: 640px;
      height: 360px;
      display: block;
    }

    #typeSetting {
      width: 200px;
    }

    #alignType {
      width: 370px;
    }

本项目引用的自定义外部资源