SOURCE


//  if(vido.ended){
//       clearInterval(tiemr);
//  }
var acodeLent = document.getElementById('coursetree').getElementsByTagName('a');
acodeLent[3].click();



function getaCode (){
    return document.getElementById('coursetree').getElementsByTagName('a');
}


var index = 0;

var vido = document.getElementById('video_html5_api');
 var isstop = document.getElementById('video_html5_api').paused; 
function open(start = 0){
    var acode = document.getElementById('coursetree').getElementsByTagName('a');
    index = start;
  acode[index].click();
  this.checkline();
}
this.open();

function checkline(){
  var vido = window.top.document.getElementsByTagName('iframe')[0].contentWindow.document.getElementsByTagName('iframe')[0].contentWindow.document.getElementById('video_html5_api');
  var isstop = vido.paused; 
    const timer = setInterval(()=>{
        // if(vido.duration === vido.currentTime){
        //     clearInterval(timer);
        //     this.index++
        //     console.log('第几个视频---',this.index);
        //     this.open(this.index);
        // }
        // if(vido.duration !== vido.currentTime && isstop){
        //     vido.playbackRate = 2;
        //     vido.play();
        // }
        if(isstop){
            vido.playbackRate = 2;
            vido.play();
            console.log('检测启动...')
        }
    },1000);
}
checkline();
function autoRun (){
   var acode = document.getElementById('coursetree').getElementsByTagName('a');
   let index = 0;
   var vido = window.top.document.getElementsByTagName('iframe')[0].contentWindow.document.getElementsByTagName('iframe')[0].contentWindow.document.getElementById('video_html5_api'); 
  acode[index].click();
window.top.document.getElementsByTagName('iframe')[0].contentWindow.document.getElementsByTagName('iframe')[0].contentWindow.document.getElementById('video_html5_api').play();
     console.log(window.top.document.getElementsByTagName('iframe')[0].contentWindow.document.getElementsByTagName('iframe')[0].contentWindow.document.getElementById('video_html5_api'));
  const timer = setInterval(()=>{
     if(index>acode.length-1){clearInterval(timer);console.log('已播放完成,请验证...')}  
     index++;
     acode[index].click();
    // vido.play();
    this.checkline();
     console.log('当前播放第',index+'个..');
  },1000*60)
}
autoRun();

function end(){
    var acode = document.getElementById('coursetree').getElementsByTagName('a');
    let index = 0;
    acode[index].click();
    const timer = setInterval(()=>{
     if(index>acode.length-1){clearInterval(timer);console.log('已播放完成,请验证...')}  
     index++;
     acode[index].click();
    // vido.play();
    
     console.log('当前播放第',index+'个..');
  },1000*60)
}
end();
setInterval(()=>{
       var vido = window.top.document.getElementsByTagName('iframe')[0].contentWindow.document.getElementsByTagName('iframe')[0].contentWindow.document.getElementById('video_html5_api'); 
           vido.playbackRate = 2;
             console.log('进来了---');
          window.top.document.getElementsByTagName('iframe')[0].contentWindow.document.getElementsByTagName('iframe')[0].contentWindow.document.getElementById('video_html5_api').play();

    },1000);



 function autoPlay(){
    var acode = document.getElementById('coursetree').getElementsByTagName('a');
    let index = 0;
    acode[index].click();
    const timer = setInterval(()=>{
     if(index>acode.length-1){clearInterval(timer);console.log('已播放完成,请验证...')}  
     index++;
     acode[index].click();
     console.log('当前播放第',index+1 +'个..');
    },1000*60*13)
}
autoPlay();
setInterval(()=>{
       var vido = window.top.document.getElementsByTagName('iframe')[0].contentWindow.document.getElementsByTagName('iframe')[0].contentWindow.document.getElementById('video_html5_api'); 
       var isstop = vido.paused; 
          if(isstop){
            vido.playbackRate = 2;
            vido.play();
            console.log('检测启动...')
        }
    },1000);
console 命令行工具 X clear

                    
>
console