mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-06 19:02:30 +01:00
Stop autoplay for unset media source with no-large-media-elements
Related feedback: - https://www.reddit.com/r/uBlockOrigin/comments/mxgpmc/
This commit is contained in:
parent
2a5e67e3f5
commit
81fadf836f
@ -213,6 +213,19 @@ const onLoadedData = function(ev) {
|
||||
media.pause();
|
||||
};
|
||||
|
||||
// https://www.reddit.com/r/uBlockOrigin/comments/mxgpmc/
|
||||
// Support cases where the media source is not yet set.
|
||||
for ( const media of document.querySelectorAll('audio,video') ) {
|
||||
const src = media.src;
|
||||
if (
|
||||
(typeof src === 'string') &&
|
||||
(src === '' || src.startsWith('blob:'))
|
||||
) {
|
||||
media.autoplay = false;
|
||||
media.pause();
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('loadeddata', onLoadedData);
|
||||
|
||||
/******************************************************************************/
|
||||
|
Loading…
Reference in New Issue
Block a user