getCurrentTime() for YouTube Video

前端 未结 4 1018
故里飘歌
故里飘歌 2021-02-14 17:02

I\'m writing a Chrome Extension in Javascript and I want to get the current time for the playing video on youtube.com. I tried using the answer from question Getting Current You

4条回答
  •  旧时难觅i
    2021-02-14 17:17

    Use the following code works for chrome extension:

    video = document.getElementsByClassName('video-stream')[0];
    console.log(video);
    console.log(video.currentTime);
    

提交回复
热议问题