简体   繁体   中英

how to stay on window/tab without actually stay on that tab

i watch video on website, when i change to other tab
video is stop playing. and when i change to old tab, video is playing

i want to know there is a trick to prevent video from stop playing?
already try scrollIntoView, focus but not working at all

this is my code (not working)

var requiredElement = document.querySelector('.watch-area-inner');
requiredElement.focus();
requiredElement.scrollIntoView({ behavior: 'smooth', block: 'start' }); 

You would need to check for blur and focus events on window . Read the Page Visibility Documentation to understand how it works. But, I guess there is no way to fake it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM