Pause/Mute HTML5 Audio/Video On Leaving Tab

Pause or mute HTML5 audio/video on leaving a tab and restore them back on returning.

< Feedback on Pause/Mute HTML5 Audio/Video On Leaving Tab

Review: Good - script works

§
Posted: 2017-12-13
Edited: 2017-12-13

How to Make an Exeption

How can I exempt a website from this script,
so that the script does not apply to this page.

Example:
I want to listen to a radio station (music, news)
on one page in a background tab,
while I am looking at something else in the foreground tab;
the background tab here would have to be exempt from Your script,
while the script still remains valid for all other sites.

jcunewsAuthor
§
Posted: 2017-12-13

You can include an @exclude script metadata. e.g. if you want to exclude youtube.com, insert below line:

// @exclude     *://*.youtube.com/*

Insert it at line #8, which is after below line:

// @include     *://*/*
§
Posted: 2017-12-13

Dear jcunews,

Very nice of You to respond so promptly.
That is what I thought, but I tried it earlier
with apparently the wrong site,
where what You said does not work.

Namely, @exclude works fine with
*://*.youtube.com/*
also fine with
*://*.cnn.com/*
etc,
but somehow
*://*.msnbc.com/*
does not work.

You can test it on :
http://www.msnbc.com/the-last-word/watch/doug-jones-triumphs-over-roy-moore-in-alabama-senate-election-1115292739644
or on
http://www.msnbc.com/brian-williams/watch/trump-tweets-congratulations-to-doug-jones-1115311171615

Using @exclude with
*://*msnbc.com*
or
*msnbc.com*
did not work either.

Any ideas ?

§
Posted: 2017-12-14

OK,
I figured out what was wrong with the MSNBC player.

The MSNBC player works inside a frame,
whose address is different from MSNBC.com,
so to address (exempt in this case) You have to use
// @exclude *://*player.theplatform.com/*

§
Posted: 2017-12-14

This user script is perfect.

jcunewsAuthor
§
Posted: 2017-12-14

Good to know it eventually worked out for you.

You may want to bookmark these for future reference.

For those @abcxyz fields:
https://wiki.greasespot.net/Metadata

For @include and @exclude:
https://wiki.greasespot.net/Includeandexclude_rules

For @match:
https://developer.chrome.com/extensions/match_patterns

§
Posted: 2017-12-14

Thanks !

Excellent resources.

Post reply

Sign in to post a reply.