企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
* 代码 ~~~ var video = $('#video_1').get(0); $('#canvas_1').on('click',function(){ if($(this).hasClass('play')){ // 状态播放时处理 $(this).removeClass('play'); video.pause(); }else{ // 状态暂停时处理 $(this).addClass('play'); video.play(); } }); var canvas = $('#canvas_1').get(0); var ctx = canvas.getContext('2d'); video.addEventListener('play', function() { var i = window.setInterval(function() {ctx.drawImage(video,0,0,canvas.width,canvas.height)},10); },false); video.addEventListener('pause',function() {window.clearInterval(i);},false); video.addEventListener('ended',function() {clearInterval(i);},false); ~~~