DEV Community

Muhammad Jazman
Muhammad Jazman

Posted on

JavaScript Bookmarklet for Vidoes

seek to last 10s

javascript:(function(){document.querySelectorAll('video').forEach(v=>{if(v.duration&&!isNaN(v.duration)){v.currentTime=Math.max(0,v.duration-10);v.play();}});})();
Enter fullscreen mode Exit fullscreen mode

Pause all videos , using video.pause()

javascript:(function(){const videos=document.querySelectorAll('video');videos.forEach(v=>v.pause());})();
Enter fullscreen mode Exit fullscreen mode

Fire a event ==pause== to all video

javascript:(function(){document.querySelectorAll('video').forEach(v=>v.dispatchEvent(new Event('pause')));})();
Enter fullscreen mode Exit fullscreen mode

Fire a event ==ended== to all video

javascript:(function(){document.querySelectorAll('video').forEach(v=>v.dispatchEvent(new Event('ended')));})();
Enter fullscreen mode Exit fullscreen mode

Top comments (0)