最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Why does my line of code to detect pausing video not work? - Stack Overflow

programmeradmin5浏览0评论
console.log(alert('WORKING'));

var videoElement = document.getElementsByClassName('video-stream')[0];

videoElement.addEventListener(
  'pause',
  function(){ 
  alert('paused!');
  }
);

I know python but am trying to learn JavaScript. Im practicing by working on a Chrome extension but I'm already stuck.

The first line works I get popup when I open youtube in my chrome browser. But the next line does not. When I pause the video I do not get a popup. But if I copy the same line it into the console in chrome it does work. I will get a popup when I pause.

发布评论

评论列表(0)

  1. 暂无评论