我为YouTube创建了Google扩展程序。我想检查视频是否结束。
我按当前时间和持续时间检查它,但是Youtube有时不更新当前时间,我无法检查它
let current = document.querySelector('span.ytp-time-current').textContent;
let duration = document.querySelector('span.ytp-time-duration').textContent;
if (current == duration) {
console.log('Video is ended');
}