mirror of
https://github.com/pixeltris/TwitchAdSolutions.git
synced 2024-11-25 20:02:52 +01:00
Remove null propagation #5
This commit is contained in:
parent
3589068eb7
commit
9ef9d278eb
@ -64,6 +64,7 @@ Tampermonkey / Greasemonkey can be used on the files suffixed by `user.js` e.g.
|
||||
- https://github.com/streamlink/streamlink (desktop application)
|
||||
- https://github.com/nopbreak/TwitchMod (android app)
|
||||
- https://twitchls.com/ (external site - purple screen may display every 10-15 mins)
|
||||
- [Use a VPN targeting a region without ads](https://reddit.com/r/Twitch/comments/kisdsy/i_did_a_little_test_regarding_ads_on_twitch_and/)
|
||||
|
||||
## NOTE/TODO
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
scope.OPT_MODE_MUTE_BLACK = false;
|
||||
scope.OPT_MODE_VIDEO_SWAP = false;
|
||||
scope.OPT_MODE_LOW_RES = false;
|
||||
scope.OPT_MODE_EMBED = false;
|
||||
scope.OPT_MODE_STRIP_AD_SEGMENTS = false;
|
||||
scope.OPT_MODE_NOTIFY_ADS_WATCHED = false;
|
||||
scope.OPT_MODE_NOTIFY_ADS_WATCHED_ATTEMPTS = 2;// Larger values might increase load time. Lower values may increase ad chance.
|
||||
@ -32,6 +33,9 @@
|
||||
scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'thunderdome';//480p
|
||||
//scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'picture-by-picture';//360p
|
||||
}
|
||||
if (!scope.OPT_ACCESS_TOKEN_PLAYER_TYPE && scope.OPT_MODE_EMBED) {
|
||||
scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'embed';
|
||||
}
|
||||
// These are only really for Worker scope...
|
||||
scope.StreamInfos = [];
|
||||
scope.StreamInfosByUrl = [];
|
||||
@ -631,12 +635,17 @@
|
||||
}
|
||||
return null;
|
||||
}
|
||||
var reactRootNode = document.querySelector('#root')?._reactRootContainer?._internalRoot?.current;
|
||||
var reactRootNode = null;
|
||||
var rootNode = document.querySelector('#root');
|
||||
if (rootNode && rootNode._reactRootContainer && rootNode._reactRootContainer._internalRoot && rootNode._reactRootContainer._internalRoot.current) {
|
||||
reactRootNode = rootNode._reactRootContainer._internalRoot.current;
|
||||
}
|
||||
if (!reactRootNode) {
|
||||
console.log('Could not find react root');
|
||||
return;
|
||||
}
|
||||
var player = findReactNode(reactRootNode, node => node.setPlayerActive && node.props?.mediaPlayerInstance)?.props?.mediaPlayerInstance;
|
||||
var player = findReactNode(reactRootNode, node => node.setPlayerActive && node.props && node.props.mediaPlayerInstance);
|
||||
player = player && player.props && player.props.mediaPlayerInstance ? player.props.mediaPlayerInstance : null;
|
||||
var playerState = findReactNode(reactRootNode, node => node.setSrc && node.setInitialPlaybackSettings);
|
||||
if (!player) {
|
||||
console.log('Could not find player');
|
||||
@ -649,10 +658,10 @@
|
||||
if (player.paused) {
|
||||
return;
|
||||
}
|
||||
const sink = player.mediaSinkManager || player.core?.mediaSinkManager;
|
||||
if (sink?.video?._ffz_compressor) {
|
||||
const sink = player.mediaSinkManager || (player.core ? player.core.mediaSinkManager : null);
|
||||
if (sink && sink.video && sink.video._ffz_compressor) {
|
||||
const video = sink.video;
|
||||
const volume = video.volume ?? player.getVolume();
|
||||
const volume = video.volume ? video.volume : player.getVolume();
|
||||
const muted = player.isMuted();
|
||||
const newVideo = document.createElement('video');
|
||||
newVideo.volume = muted ? 0 : volume;
|
||||
|
@ -6,6 +6,7 @@ twitch-videoad.js application/javascript
|
||||
scope.OPT_MODE_MUTE_BLACK = false;
|
||||
scope.OPT_MODE_VIDEO_SWAP = false;
|
||||
scope.OPT_MODE_LOW_RES = false;
|
||||
scope.OPT_MODE_EMBED = false;
|
||||
scope.OPT_MODE_STRIP_AD_SEGMENTS = false;
|
||||
scope.OPT_MODE_NOTIFY_ADS_WATCHED = true;
|
||||
scope.OPT_MODE_NOTIFY_ADS_WATCHED_ATTEMPTS = 1;
|
||||
@ -23,6 +24,9 @@ twitch-videoad.js application/javascript
|
||||
scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'thunderdome';//480p
|
||||
//scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'picture-by-picture';//360p
|
||||
}
|
||||
if (!scope.OPT_ACCESS_TOKEN_PLAYER_TYPE && scope.OPT_MODE_EMBED) {
|
||||
scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'embed';
|
||||
}
|
||||
// These are only really for Worker scope...
|
||||
scope.StreamInfos = [];
|
||||
scope.StreamInfosByUrl = [];
|
||||
@ -622,12 +626,17 @@ twitch-videoad.js application/javascript
|
||||
}
|
||||
return null;
|
||||
}
|
||||
var reactRootNode = document.querySelector('#root')?._reactRootContainer?._internalRoot?.current;
|
||||
var reactRootNode = null;
|
||||
var rootNode = document.querySelector('#root');
|
||||
if (rootNode && rootNode._reactRootContainer && rootNode._reactRootContainer._internalRoot && rootNode._reactRootContainer._internalRoot.current) {
|
||||
reactRootNode = rootNode._reactRootContainer._internalRoot.current;
|
||||
}
|
||||
if (!reactRootNode) {
|
||||
console.log('Could not find react root');
|
||||
return;
|
||||
}
|
||||
var player = findReactNode(reactRootNode, node => node.setPlayerActive && node.props?.mediaPlayerInstance)?.props?.mediaPlayerInstance;
|
||||
var player = findReactNode(reactRootNode, node => node.setPlayerActive && node.props && node.props.mediaPlayerInstance);
|
||||
player = player && player.props && player.props.mediaPlayerInstance ? player.props.mediaPlayerInstance : null;
|
||||
var playerState = findReactNode(reactRootNode, node => node.setSrc && node.setInitialPlaybackSettings);
|
||||
if (!player) {
|
||||
console.log('Could not find player');
|
||||
@ -640,10 +649,10 @@ twitch-videoad.js application/javascript
|
||||
if (player.paused) {
|
||||
return;
|
||||
}
|
||||
const sink = player.mediaSinkManager || player.core?.mediaSinkManager;
|
||||
if (sink?.video?._ffz_compressor) {
|
||||
const sink = player.mediaSinkManager || (player.core ? player.core.mediaSinkManager : null);
|
||||
if (sink && sink.video && sink.video._ffz_compressor) {
|
||||
const video = sink.video;
|
||||
const volume = video.volume ?? player.getVolume();
|
||||
const volume = video.volume ? video.volume : player.getVolume();
|
||||
const muted = player.isMuted();
|
||||
const newVideo = document.createElement('video');
|
||||
newVideo.volume = muted ? 0 : volume;
|
||||
|
@ -15,6 +15,7 @@
|
||||
scope.OPT_MODE_MUTE_BLACK = false;
|
||||
scope.OPT_MODE_VIDEO_SWAP = false;
|
||||
scope.OPT_MODE_LOW_RES = false;
|
||||
scope.OPT_MODE_EMBED = false;
|
||||
scope.OPT_MODE_STRIP_AD_SEGMENTS = false;
|
||||
scope.OPT_MODE_NOTIFY_ADS_WATCHED = true;
|
||||
scope.OPT_MODE_NOTIFY_ADS_WATCHED_ATTEMPTS = 1;
|
||||
@ -32,6 +33,9 @@
|
||||
scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'thunderdome';//480p
|
||||
//scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'picture-by-picture';//360p
|
||||
}
|
||||
if (!scope.OPT_ACCESS_TOKEN_PLAYER_TYPE && scope.OPT_MODE_EMBED) {
|
||||
scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'embed';
|
||||
}
|
||||
// These are only really for Worker scope...
|
||||
scope.StreamInfos = [];
|
||||
scope.StreamInfosByUrl = [];
|
||||
@ -631,12 +635,17 @@
|
||||
}
|
||||
return null;
|
||||
}
|
||||
var reactRootNode = document.querySelector('#root')?._reactRootContainer?._internalRoot?.current;
|
||||
var reactRootNode = null;
|
||||
var rootNode = document.querySelector('#root');
|
||||
if (rootNode && rootNode._reactRootContainer && rootNode._reactRootContainer._internalRoot && rootNode._reactRootContainer._internalRoot.current) {
|
||||
reactRootNode = rootNode._reactRootContainer._internalRoot.current;
|
||||
}
|
||||
if (!reactRootNode) {
|
||||
console.log('Could not find react root');
|
||||
return;
|
||||
}
|
||||
var player = findReactNode(reactRootNode, node => node.setPlayerActive && node.props?.mediaPlayerInstance)?.props?.mediaPlayerInstance;
|
||||
var player = findReactNode(reactRootNode, node => node.setPlayerActive && node.props && node.props.mediaPlayerInstance);
|
||||
player = player && player.props && player.props.mediaPlayerInstance ? player.props.mediaPlayerInstance : null;
|
||||
var playerState = findReactNode(reactRootNode, node => node.setSrc && node.setInitialPlaybackSettings);
|
||||
if (!player) {
|
||||
console.log('Could not find player');
|
||||
@ -649,10 +658,10 @@
|
||||
if (player.paused) {
|
||||
return;
|
||||
}
|
||||
const sink = player.mediaSinkManager || player.core?.mediaSinkManager;
|
||||
if (sink?.video?._ffz_compressor) {
|
||||
const sink = player.mediaSinkManager || (player.core ? player.core.mediaSinkManager : null);
|
||||
if (sink && sink.video && sink.video._ffz_compressor) {
|
||||
const video = sink.video;
|
||||
const volume = video.volume ?? player.getVolume();
|
||||
const volume = video.volume ? video.volume : player.getVolume();
|
||||
const muted = player.isMuted();
|
||||
const newVideo = document.createElement('video');
|
||||
newVideo.volume = muted ? 0 : volume;
|
||||
|
@ -6,6 +6,7 @@ twitch-videoad.js application/javascript
|
||||
scope.OPT_MODE_MUTE_BLACK = true;
|
||||
scope.OPT_MODE_VIDEO_SWAP = false;
|
||||
scope.OPT_MODE_LOW_RES = false;
|
||||
scope.OPT_MODE_EMBED = false;
|
||||
scope.OPT_MODE_STRIP_AD_SEGMENTS = false;
|
||||
scope.OPT_MODE_NOTIFY_ADS_WATCHED = true;
|
||||
scope.OPT_MODE_NOTIFY_ADS_WATCHED_ATTEMPTS = 2;// Larger values might increase load time. Lower values may increase ad chance.
|
||||
@ -23,6 +24,9 @@ twitch-videoad.js application/javascript
|
||||
scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'thunderdome';//480p
|
||||
//scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'picture-by-picture';//360p
|
||||
}
|
||||
if (!scope.OPT_ACCESS_TOKEN_PLAYER_TYPE && scope.OPT_MODE_EMBED) {
|
||||
scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'embed';
|
||||
}
|
||||
// These are only really for Worker scope...
|
||||
scope.StreamInfos = [];
|
||||
scope.StreamInfosByUrl = [];
|
||||
@ -622,12 +626,17 @@ twitch-videoad.js application/javascript
|
||||
}
|
||||
return null;
|
||||
}
|
||||
var reactRootNode = document.querySelector('#root')?._reactRootContainer?._internalRoot?.current;
|
||||
var reactRootNode = null;
|
||||
var rootNode = document.querySelector('#root');
|
||||
if (rootNode && rootNode._reactRootContainer && rootNode._reactRootContainer._internalRoot && rootNode._reactRootContainer._internalRoot.current) {
|
||||
reactRootNode = rootNode._reactRootContainer._internalRoot.current;
|
||||
}
|
||||
if (!reactRootNode) {
|
||||
console.log('Could not find react root');
|
||||
return;
|
||||
}
|
||||
var player = findReactNode(reactRootNode, node => node.setPlayerActive && node.props?.mediaPlayerInstance)?.props?.mediaPlayerInstance;
|
||||
var player = findReactNode(reactRootNode, node => node.setPlayerActive && node.props && node.props.mediaPlayerInstance);
|
||||
player = player && player.props && player.props.mediaPlayerInstance ? player.props.mediaPlayerInstance : null;
|
||||
var playerState = findReactNode(reactRootNode, node => node.setSrc && node.setInitialPlaybackSettings);
|
||||
if (!player) {
|
||||
console.log('Could not find player');
|
||||
@ -640,10 +649,10 @@ twitch-videoad.js application/javascript
|
||||
if (player.paused) {
|
||||
return;
|
||||
}
|
||||
const sink = player.mediaSinkManager || player.core?.mediaSinkManager;
|
||||
if (sink?.video?._ffz_compressor) {
|
||||
const sink = player.mediaSinkManager || (player.core ? player.core.mediaSinkManager : null);
|
||||
if (sink && sink.video && sink.video._ffz_compressor) {
|
||||
const video = sink.video;
|
||||
const volume = video.volume ?? player.getVolume();
|
||||
const volume = video.volume ? video.volume : player.getVolume();
|
||||
const muted = player.isMuted();
|
||||
const newVideo = document.createElement('video');
|
||||
newVideo.volume = muted ? 0 : volume;
|
||||
|
@ -15,6 +15,7 @@
|
||||
scope.OPT_MODE_MUTE_BLACK = true;
|
||||
scope.OPT_MODE_VIDEO_SWAP = false;
|
||||
scope.OPT_MODE_LOW_RES = false;
|
||||
scope.OPT_MODE_EMBED = false;
|
||||
scope.OPT_MODE_STRIP_AD_SEGMENTS = false;
|
||||
scope.OPT_MODE_NOTIFY_ADS_WATCHED = true;
|
||||
scope.OPT_MODE_NOTIFY_ADS_WATCHED_ATTEMPTS = 2;// Larger values might increase load time. Lower values may increase ad chance.
|
||||
@ -32,6 +33,9 @@
|
||||
scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'thunderdome';//480p
|
||||
//scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'picture-by-picture';//360p
|
||||
}
|
||||
if (!scope.OPT_ACCESS_TOKEN_PLAYER_TYPE && scope.OPT_MODE_EMBED) {
|
||||
scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'embed';
|
||||
}
|
||||
// These are only really for Worker scope...
|
||||
scope.StreamInfos = [];
|
||||
scope.StreamInfosByUrl = [];
|
||||
@ -631,12 +635,17 @@
|
||||
}
|
||||
return null;
|
||||
}
|
||||
var reactRootNode = document.querySelector('#root')?._reactRootContainer?._internalRoot?.current;
|
||||
var reactRootNode = null;
|
||||
var rootNode = document.querySelector('#root');
|
||||
if (rootNode && rootNode._reactRootContainer && rootNode._reactRootContainer._internalRoot && rootNode._reactRootContainer._internalRoot.current) {
|
||||
reactRootNode = rootNode._reactRootContainer._internalRoot.current;
|
||||
}
|
||||
if (!reactRootNode) {
|
||||
console.log('Could not find react root');
|
||||
return;
|
||||
}
|
||||
var player = findReactNode(reactRootNode, node => node.setPlayerActive && node.props?.mediaPlayerInstance)?.props?.mediaPlayerInstance;
|
||||
var player = findReactNode(reactRootNode, node => node.setPlayerActive && node.props && node.props.mediaPlayerInstance);
|
||||
player = player && player.props && player.props.mediaPlayerInstance ? player.props.mediaPlayerInstance : null;
|
||||
var playerState = findReactNode(reactRootNode, node => node.setSrc && node.setInitialPlaybackSettings);
|
||||
if (!player) {
|
||||
console.log('Could not find player');
|
||||
@ -649,10 +658,10 @@
|
||||
if (player.paused) {
|
||||
return;
|
||||
}
|
||||
const sink = player.mediaSinkManager || player.core?.mediaSinkManager;
|
||||
if (sink?.video?._ffz_compressor) {
|
||||
const sink = player.mediaSinkManager || (player.core ? player.core.mediaSinkManager : null);
|
||||
if (sink && sink.video && sink.video._ffz_compressor) {
|
||||
const video = sink.video;
|
||||
const volume = video.volume ?? player.getVolume();
|
||||
const volume = video.volume ? video.volume : player.getVolume();
|
||||
const muted = player.isMuted();
|
||||
const newVideo = document.createElement('video');
|
||||
newVideo.volume = muted ? 0 : volume;
|
||||
|
@ -6,6 +6,7 @@ twitch-videoad.js application/javascript
|
||||
scope.OPT_MODE_MUTE_BLACK = false;
|
||||
scope.OPT_MODE_VIDEO_SWAP = true;
|
||||
scope.OPT_MODE_LOW_RES = false;
|
||||
scope.OPT_MODE_EMBED = false;
|
||||
scope.OPT_MODE_STRIP_AD_SEGMENTS = false;
|
||||
scope.OPT_MODE_NOTIFY_ADS_WATCHED = false;
|
||||
scope.OPT_MODE_NOTIFY_ADS_WATCHED_ATTEMPTS = 2;// Larger values might increase load time. Lower values may increase ad chance.
|
||||
@ -23,6 +24,9 @@ twitch-videoad.js application/javascript
|
||||
scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'thunderdome';//480p
|
||||
//scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'picture-by-picture';//360p
|
||||
}
|
||||
if (!scope.OPT_ACCESS_TOKEN_PLAYER_TYPE && scope.OPT_MODE_EMBED) {
|
||||
scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'embed';
|
||||
}
|
||||
// These are only really for Worker scope...
|
||||
scope.StreamInfos = [];
|
||||
scope.StreamInfosByUrl = [];
|
||||
@ -622,12 +626,17 @@ twitch-videoad.js application/javascript
|
||||
}
|
||||
return null;
|
||||
}
|
||||
var reactRootNode = document.querySelector('#root')?._reactRootContainer?._internalRoot?.current;
|
||||
var reactRootNode = null;
|
||||
var rootNode = document.querySelector('#root');
|
||||
if (rootNode && rootNode._reactRootContainer && rootNode._reactRootContainer._internalRoot && rootNode._reactRootContainer._internalRoot.current) {
|
||||
reactRootNode = rootNode._reactRootContainer._internalRoot.current;
|
||||
}
|
||||
if (!reactRootNode) {
|
||||
console.log('Could not find react root');
|
||||
return;
|
||||
}
|
||||
var player = findReactNode(reactRootNode, node => node.setPlayerActive && node.props?.mediaPlayerInstance)?.props?.mediaPlayerInstance;
|
||||
var player = findReactNode(reactRootNode, node => node.setPlayerActive && node.props && node.props.mediaPlayerInstance);
|
||||
player = player && player.props && player.props.mediaPlayerInstance ? player.props.mediaPlayerInstance : null;
|
||||
var playerState = findReactNode(reactRootNode, node => node.setSrc && node.setInitialPlaybackSettings);
|
||||
if (!player) {
|
||||
console.log('Could not find player');
|
||||
@ -640,10 +649,10 @@ twitch-videoad.js application/javascript
|
||||
if (player.paused) {
|
||||
return;
|
||||
}
|
||||
const sink = player.mediaSinkManager || player.core?.mediaSinkManager;
|
||||
if (sink?.video?._ffz_compressor) {
|
||||
const sink = player.mediaSinkManager || (player.core ? player.core.mediaSinkManager : null);
|
||||
if (sink && sink.video && sink.video._ffz_compressor) {
|
||||
const video = sink.video;
|
||||
const volume = video.volume ?? player.getVolume();
|
||||
const volume = video.volume ? video.volume : player.getVolume();
|
||||
const muted = player.isMuted();
|
||||
const newVideo = document.createElement('video');
|
||||
newVideo.volume = muted ? 0 : volume;
|
||||
|
@ -15,6 +15,7 @@
|
||||
scope.OPT_MODE_MUTE_BLACK = false;
|
||||
scope.OPT_MODE_VIDEO_SWAP = true;
|
||||
scope.OPT_MODE_LOW_RES = false;
|
||||
scope.OPT_MODE_EMBED = false;
|
||||
scope.OPT_MODE_STRIP_AD_SEGMENTS = false;
|
||||
scope.OPT_MODE_NOTIFY_ADS_WATCHED = false;
|
||||
scope.OPT_MODE_NOTIFY_ADS_WATCHED_ATTEMPTS = 2;// Larger values might increase load time. Lower values may increase ad chance.
|
||||
@ -32,6 +33,9 @@
|
||||
scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'thunderdome';//480p
|
||||
//scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'picture-by-picture';//360p
|
||||
}
|
||||
if (!scope.OPT_ACCESS_TOKEN_PLAYER_TYPE && scope.OPT_MODE_EMBED) {
|
||||
scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'embed';
|
||||
}
|
||||
// These are only really for Worker scope...
|
||||
scope.StreamInfos = [];
|
||||
scope.StreamInfosByUrl = [];
|
||||
@ -631,12 +635,17 @@
|
||||
}
|
||||
return null;
|
||||
}
|
||||
var reactRootNode = document.querySelector('#root')?._reactRootContainer?._internalRoot?.current;
|
||||
var reactRootNode = null;
|
||||
var rootNode = document.querySelector('#root');
|
||||
if (rootNode && rootNode._reactRootContainer && rootNode._reactRootContainer._internalRoot && rootNode._reactRootContainer._internalRoot.current) {
|
||||
reactRootNode = rootNode._reactRootContainer._internalRoot.current;
|
||||
}
|
||||
if (!reactRootNode) {
|
||||
console.log('Could not find react root');
|
||||
return;
|
||||
}
|
||||
var player = findReactNode(reactRootNode, node => node.setPlayerActive && node.props?.mediaPlayerInstance)?.props?.mediaPlayerInstance;
|
||||
var player = findReactNode(reactRootNode, node => node.setPlayerActive && node.props && node.props.mediaPlayerInstance);
|
||||
player = player && player.props && player.props.mediaPlayerInstance ? player.props.mediaPlayerInstance : null;
|
||||
var playerState = findReactNode(reactRootNode, node => node.setSrc && node.setInitialPlaybackSettings);
|
||||
if (!player) {
|
||||
console.log('Could not find player');
|
||||
@ -649,10 +658,10 @@
|
||||
if (player.paused) {
|
||||
return;
|
||||
}
|
||||
const sink = player.mediaSinkManager || player.core?.mediaSinkManager;
|
||||
if (sink?.video?._ffz_compressor) {
|
||||
const sink = player.mediaSinkManager || (player.core ? player.core.mediaSinkManager : null);
|
||||
if (sink && sink.video && sink.video._ffz_compressor) {
|
||||
const video = sink.video;
|
||||
const volume = video.volume ?? player.getVolume();
|
||||
const volume = video.volume ? video.volume : player.getVolume();
|
||||
const muted = player.isMuted();
|
||||
const newVideo = document.createElement('video');
|
||||
newVideo.volume = muted ? 0 : volume;
|
||||
|
@ -6,6 +6,7 @@ twitch-videoad.js application/javascript
|
||||
scope.OPT_MODE_MUTE_BLACK = false;
|
||||
scope.OPT_MODE_VIDEO_SWAP = false;
|
||||
scope.OPT_MODE_LOW_RES = false;
|
||||
scope.OPT_MODE_EMBED = false;
|
||||
scope.OPT_MODE_STRIP_AD_SEGMENTS = true;
|
||||
scope.OPT_MODE_NOTIFY_ADS_WATCHED = false;
|
||||
scope.OPT_MODE_NOTIFY_ADS_WATCHED_ATTEMPTS = 2;// Larger values might increase load time. Lower values may increase ad chance.
|
||||
@ -23,6 +24,9 @@ twitch-videoad.js application/javascript
|
||||
scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'thunderdome';//480p
|
||||
//scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'picture-by-picture';//360p
|
||||
}
|
||||
if (!scope.OPT_ACCESS_TOKEN_PLAYER_TYPE && scope.OPT_MODE_EMBED) {
|
||||
scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'embed';
|
||||
}
|
||||
// These are only really for Worker scope...
|
||||
scope.StreamInfos = [];
|
||||
scope.StreamInfosByUrl = [];
|
||||
@ -622,12 +626,17 @@ twitch-videoad.js application/javascript
|
||||
}
|
||||
return null;
|
||||
}
|
||||
var reactRootNode = document.querySelector('#root')?._reactRootContainer?._internalRoot?.current;
|
||||
var reactRootNode = null;
|
||||
var rootNode = document.querySelector('#root');
|
||||
if (rootNode && rootNode._reactRootContainer && rootNode._reactRootContainer._internalRoot && rootNode._reactRootContainer._internalRoot.current) {
|
||||
reactRootNode = rootNode._reactRootContainer._internalRoot.current;
|
||||
}
|
||||
if (!reactRootNode) {
|
||||
console.log('Could not find react root');
|
||||
return;
|
||||
}
|
||||
var player = findReactNode(reactRootNode, node => node.setPlayerActive && node.props?.mediaPlayerInstance)?.props?.mediaPlayerInstance;
|
||||
var player = findReactNode(reactRootNode, node => node.setPlayerActive && node.props && node.props.mediaPlayerInstance);
|
||||
player = player && player.props && player.props.mediaPlayerInstance ? player.props.mediaPlayerInstance : null;
|
||||
var playerState = findReactNode(reactRootNode, node => node.setSrc && node.setInitialPlaybackSettings);
|
||||
if (!player) {
|
||||
console.log('Could not find player');
|
||||
@ -640,10 +649,10 @@ twitch-videoad.js application/javascript
|
||||
if (player.paused) {
|
||||
return;
|
||||
}
|
||||
const sink = player.mediaSinkManager || player.core?.mediaSinkManager;
|
||||
if (sink?.video?._ffz_compressor) {
|
||||
const sink = player.mediaSinkManager || (player.core ? player.core.mediaSinkManager : null);
|
||||
if (sink && sink.video && sink.video._ffz_compressor) {
|
||||
const video = sink.video;
|
||||
const volume = video.volume ?? player.getVolume();
|
||||
const volume = video.volume ? video.volume : player.getVolume();
|
||||
const muted = player.isMuted();
|
||||
const newVideo = document.createElement('video');
|
||||
newVideo.volume = muted ? 0 : volume;
|
||||
|
@ -15,6 +15,7 @@
|
||||
scope.OPT_MODE_MUTE_BLACK = false;
|
||||
scope.OPT_MODE_VIDEO_SWAP = false;
|
||||
scope.OPT_MODE_LOW_RES = false;
|
||||
scope.OPT_MODE_EMBED = false;
|
||||
scope.OPT_MODE_STRIP_AD_SEGMENTS = true;
|
||||
scope.OPT_MODE_NOTIFY_ADS_WATCHED = false;
|
||||
scope.OPT_MODE_NOTIFY_ADS_WATCHED_ATTEMPTS = 2;// Larger values might increase load time. Lower values may increase ad chance.
|
||||
@ -32,6 +33,9 @@
|
||||
scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'thunderdome';//480p
|
||||
//scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'picture-by-picture';//360p
|
||||
}
|
||||
if (!scope.OPT_ACCESS_TOKEN_PLAYER_TYPE && scope.OPT_MODE_EMBED) {
|
||||
scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'embed';
|
||||
}
|
||||
// These are only really for Worker scope...
|
||||
scope.StreamInfos = [];
|
||||
scope.StreamInfosByUrl = [];
|
||||
@ -631,12 +635,17 @@
|
||||
}
|
||||
return null;
|
||||
}
|
||||
var reactRootNode = document.querySelector('#root')?._reactRootContainer?._internalRoot?.current;
|
||||
var reactRootNode = null;
|
||||
var rootNode = document.querySelector('#root');
|
||||
if (rootNode && rootNode._reactRootContainer && rootNode._reactRootContainer._internalRoot && rootNode._reactRootContainer._internalRoot.current) {
|
||||
reactRootNode = rootNode._reactRootContainer._internalRoot.current;
|
||||
}
|
||||
if (!reactRootNode) {
|
||||
console.log('Could not find react root');
|
||||
return;
|
||||
}
|
||||
var player = findReactNode(reactRootNode, node => node.setPlayerActive && node.props?.mediaPlayerInstance)?.props?.mediaPlayerInstance;
|
||||
var player = findReactNode(reactRootNode, node => node.setPlayerActive && node.props && node.props.mediaPlayerInstance);
|
||||
player = player && player.props && player.props.mediaPlayerInstance ? player.props.mediaPlayerInstance : null;
|
||||
var playerState = findReactNode(reactRootNode, node => node.setSrc && node.setInitialPlaybackSettings);
|
||||
if (!player) {
|
||||
console.log('Could not find player');
|
||||
@ -649,10 +658,10 @@
|
||||
if (player.paused) {
|
||||
return;
|
||||
}
|
||||
const sink = player.mediaSinkManager || player.core?.mediaSinkManager;
|
||||
if (sink?.video?._ffz_compressor) {
|
||||
const sink = player.mediaSinkManager || (player.core ? player.core.mediaSinkManager : null);
|
||||
if (sink && sink.video && sink.video._ffz_compressor) {
|
||||
const video = sink.video;
|
||||
const volume = video.volume ?? player.getVolume();
|
||||
const volume = video.volume ? video.volume : player.getVolume();
|
||||
const muted = player.isMuted();
|
||||
const newVideo = document.createElement('video');
|
||||
newVideo.volume = muted ? 0 : volume;
|
||||
|
@ -6,6 +6,7 @@ twitch-videoad.js application/javascript
|
||||
scope.OPT_MODE_MUTE_BLACK = true;
|
||||
scope.OPT_MODE_VIDEO_SWAP = false;
|
||||
scope.OPT_MODE_LOW_RES = false;
|
||||
scope.OPT_MODE_EMBED = false;
|
||||
scope.OPT_MODE_STRIP_AD_SEGMENTS = false;
|
||||
scope.OPT_MODE_NOTIFY_ADS_WATCHED = false;
|
||||
scope.OPT_MODE_NOTIFY_ADS_WATCHED_ATTEMPTS = 2;// Larger values might increase load time. Lower values may increase ad chance.
|
||||
@ -23,6 +24,9 @@ twitch-videoad.js application/javascript
|
||||
scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'thunderdome';//480p
|
||||
//scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'picture-by-picture';//360p
|
||||
}
|
||||
if (!scope.OPT_ACCESS_TOKEN_PLAYER_TYPE && scope.OPT_MODE_EMBED) {
|
||||
scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'embed';
|
||||
}
|
||||
// These are only really for Worker scope...
|
||||
scope.StreamInfos = [];
|
||||
scope.StreamInfosByUrl = [];
|
||||
@ -622,12 +626,17 @@ twitch-videoad.js application/javascript
|
||||
}
|
||||
return null;
|
||||
}
|
||||
var reactRootNode = document.querySelector('#root')?._reactRootContainer?._internalRoot?.current;
|
||||
var reactRootNode = null;
|
||||
var rootNode = document.querySelector('#root');
|
||||
if (rootNode && rootNode._reactRootContainer && rootNode._reactRootContainer._internalRoot && rootNode._reactRootContainer._internalRoot.current) {
|
||||
reactRootNode = rootNode._reactRootContainer._internalRoot.current;
|
||||
}
|
||||
if (!reactRootNode) {
|
||||
console.log('Could not find react root');
|
||||
return;
|
||||
}
|
||||
var player = findReactNode(reactRootNode, node => node.setPlayerActive && node.props?.mediaPlayerInstance)?.props?.mediaPlayerInstance;
|
||||
var player = findReactNode(reactRootNode, node => node.setPlayerActive && node.props && node.props.mediaPlayerInstance);
|
||||
player = player && player.props && player.props.mediaPlayerInstance ? player.props.mediaPlayerInstance : null;
|
||||
var playerState = findReactNode(reactRootNode, node => node.setSrc && node.setInitialPlaybackSettings);
|
||||
if (!player) {
|
||||
console.log('Could not find player');
|
||||
@ -640,10 +649,10 @@ twitch-videoad.js application/javascript
|
||||
if (player.paused) {
|
||||
return;
|
||||
}
|
||||
const sink = player.mediaSinkManager || player.core?.mediaSinkManager;
|
||||
if (sink?.video?._ffz_compressor) {
|
||||
const sink = player.mediaSinkManager || (player.core ? player.core.mediaSinkManager : null);
|
||||
if (sink && sink.video && sink.video._ffz_compressor) {
|
||||
const video = sink.video;
|
||||
const volume = video.volume ?? player.getVolume();
|
||||
const volume = video.volume ? video.volume : player.getVolume();
|
||||
const muted = player.isMuted();
|
||||
const newVideo = document.createElement('video');
|
||||
newVideo.volume = muted ? 0 : volume;
|
||||
|
@ -15,6 +15,7 @@
|
||||
scope.OPT_MODE_MUTE_BLACK = true;
|
||||
scope.OPT_MODE_VIDEO_SWAP = false;
|
||||
scope.OPT_MODE_LOW_RES = false;
|
||||
scope.OPT_MODE_EMBED = false;
|
||||
scope.OPT_MODE_STRIP_AD_SEGMENTS = false;
|
||||
scope.OPT_MODE_NOTIFY_ADS_WATCHED = false;
|
||||
scope.OPT_MODE_NOTIFY_ADS_WATCHED_ATTEMPTS = 2;// Larger values might increase load time. Lower values may increase ad chance.
|
||||
@ -32,6 +33,9 @@
|
||||
scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'thunderdome';//480p
|
||||
//scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'picture-by-picture';//360p
|
||||
}
|
||||
if (!scope.OPT_ACCESS_TOKEN_PLAYER_TYPE && scope.OPT_MODE_EMBED) {
|
||||
scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'embed';
|
||||
}
|
||||
// These are only really for Worker scope...
|
||||
scope.StreamInfos = [];
|
||||
scope.StreamInfosByUrl = [];
|
||||
@ -631,12 +635,17 @@
|
||||
}
|
||||
return null;
|
||||
}
|
||||
var reactRootNode = document.querySelector('#root')?._reactRootContainer?._internalRoot?.current;
|
||||
var reactRootNode = null;
|
||||
var rootNode = document.querySelector('#root');
|
||||
if (rootNode && rootNode._reactRootContainer && rootNode._reactRootContainer._internalRoot && rootNode._reactRootContainer._internalRoot.current) {
|
||||
reactRootNode = rootNode._reactRootContainer._internalRoot.current;
|
||||
}
|
||||
if (!reactRootNode) {
|
||||
console.log('Could not find react root');
|
||||
return;
|
||||
}
|
||||
var player = findReactNode(reactRootNode, node => node.setPlayerActive && node.props?.mediaPlayerInstance)?.props?.mediaPlayerInstance;
|
||||
var player = findReactNode(reactRootNode, node => node.setPlayerActive && node.props && node.props.mediaPlayerInstance);
|
||||
player = player && player.props && player.props.mediaPlayerInstance ? player.props.mediaPlayerInstance : null;
|
||||
var playerState = findReactNode(reactRootNode, node => node.setSrc && node.setInitialPlaybackSettings);
|
||||
if (!player) {
|
||||
console.log('Could not find player');
|
||||
@ -649,10 +658,10 @@
|
||||
if (player.paused) {
|
||||
return;
|
||||
}
|
||||
const sink = player.mediaSinkManager || player.core?.mediaSinkManager;
|
||||
if (sink?.video?._ffz_compressor) {
|
||||
const sink = player.mediaSinkManager || (player.core ? player.core.mediaSinkManager : null);
|
||||
if (sink && sink.video && sink.video._ffz_compressor) {
|
||||
const video = sink.video;
|
||||
const volume = video.volume ?? player.getVolume();
|
||||
const volume = video.volume ? video.volume : player.getVolume();
|
||||
const muted = player.isMuted();
|
||||
const newVideo = document.createElement('video');
|
||||
newVideo.volume = muted ? 0 : volume;
|
||||
|
@ -6,6 +6,7 @@ twitch-videoad.js application/javascript
|
||||
scope.OPT_MODE_MUTE_BLACK = false;
|
||||
scope.OPT_MODE_VIDEO_SWAP = false;
|
||||
scope.OPT_MODE_LOW_RES = false;
|
||||
scope.OPT_MODE_EMBED = false;
|
||||
scope.OPT_MODE_STRIP_AD_SEGMENTS = false;
|
||||
scope.OPT_MODE_NOTIFY_ADS_WATCHED = false;
|
||||
scope.OPT_MODE_NOTIFY_ADS_WATCHED_ATTEMPTS = 2;// Larger values might increase load time. Lower values may increase ad chance.
|
||||
@ -23,6 +24,9 @@ twitch-videoad.js application/javascript
|
||||
scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'thunderdome';//480p
|
||||
//scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'picture-by-picture';//360p
|
||||
}
|
||||
if (!scope.OPT_ACCESS_TOKEN_PLAYER_TYPE && scope.OPT_MODE_EMBED) {
|
||||
scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'embed';
|
||||
}
|
||||
// These are only really for Worker scope...
|
||||
scope.StreamInfos = [];
|
||||
scope.StreamInfosByUrl = [];
|
||||
@ -622,12 +626,17 @@ twitch-videoad.js application/javascript
|
||||
}
|
||||
return null;
|
||||
}
|
||||
var reactRootNode = document.querySelector('#root')?._reactRootContainer?._internalRoot?.current;
|
||||
var reactRootNode = null;
|
||||
var rootNode = document.querySelector('#root');
|
||||
if (rootNode && rootNode._reactRootContainer && rootNode._reactRootContainer._internalRoot && rootNode._reactRootContainer._internalRoot.current) {
|
||||
reactRootNode = rootNode._reactRootContainer._internalRoot.current;
|
||||
}
|
||||
if (!reactRootNode) {
|
||||
console.log('Could not find react root');
|
||||
return;
|
||||
}
|
||||
var player = findReactNode(reactRootNode, node => node.setPlayerActive && node.props?.mediaPlayerInstance)?.props?.mediaPlayerInstance;
|
||||
var player = findReactNode(reactRootNode, node => node.setPlayerActive && node.props && node.props.mediaPlayerInstance);
|
||||
player = player && player.props && player.props.mediaPlayerInstance ? player.props.mediaPlayerInstance : null;
|
||||
var playerState = findReactNode(reactRootNode, node => node.setSrc && node.setInitialPlaybackSettings);
|
||||
if (!player) {
|
||||
console.log('Could not find player');
|
||||
@ -640,10 +649,10 @@ twitch-videoad.js application/javascript
|
||||
if (player.paused) {
|
||||
return;
|
||||
}
|
||||
const sink = player.mediaSinkManager || player.core?.mediaSinkManager;
|
||||
if (sink?.video?._ffz_compressor) {
|
||||
const sink = player.mediaSinkManager || (player.core ? player.core.mediaSinkManager : null);
|
||||
if (sink && sink.video && sink.video._ffz_compressor) {
|
||||
const video = sink.video;
|
||||
const volume = video.volume ?? player.getVolume();
|
||||
const volume = video.volume ? video.volume : player.getVolume();
|
||||
const muted = player.isMuted();
|
||||
const newVideo = document.createElement('video');
|
||||
newVideo.volume = muted ? 0 : volume;
|
||||
|
@ -15,6 +15,7 @@
|
||||
scope.OPT_MODE_MUTE_BLACK = false;
|
||||
scope.OPT_MODE_VIDEO_SWAP = false;
|
||||
scope.OPT_MODE_LOW_RES = false;
|
||||
scope.OPT_MODE_EMBED = false;
|
||||
scope.OPT_MODE_STRIP_AD_SEGMENTS = false;
|
||||
scope.OPT_MODE_NOTIFY_ADS_WATCHED = false;
|
||||
scope.OPT_MODE_NOTIFY_ADS_WATCHED_ATTEMPTS = 2;// Larger values might increase load time. Lower values may increase ad chance.
|
||||
@ -32,6 +33,9 @@
|
||||
scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'thunderdome';//480p
|
||||
//scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'picture-by-picture';//360p
|
||||
}
|
||||
if (!scope.OPT_ACCESS_TOKEN_PLAYER_TYPE && scope.OPT_MODE_EMBED) {
|
||||
scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = 'embed';
|
||||
}
|
||||
// These are only really for Worker scope...
|
||||
scope.StreamInfos = [];
|
||||
scope.StreamInfosByUrl = [];
|
||||
@ -631,12 +635,17 @@
|
||||
}
|
||||
return null;
|
||||
}
|
||||
var reactRootNode = document.querySelector('#root')?._reactRootContainer?._internalRoot?.current;
|
||||
var reactRootNode = null;
|
||||
var rootNode = document.querySelector('#root');
|
||||
if (rootNode && rootNode._reactRootContainer && rootNode._reactRootContainer._internalRoot && rootNode._reactRootContainer._internalRoot.current) {
|
||||
reactRootNode = rootNode._reactRootContainer._internalRoot.current;
|
||||
}
|
||||
if (!reactRootNode) {
|
||||
console.log('Could not find react root');
|
||||
return;
|
||||
}
|
||||
var player = findReactNode(reactRootNode, node => node.setPlayerActive && node.props?.mediaPlayerInstance)?.props?.mediaPlayerInstance;
|
||||
var player = findReactNode(reactRootNode, node => node.setPlayerActive && node.props && node.props.mediaPlayerInstance);
|
||||
player = player && player.props && player.props.mediaPlayerInstance ? player.props.mediaPlayerInstance : null;
|
||||
var playerState = findReactNode(reactRootNode, node => node.setSrc && node.setInitialPlaybackSettings);
|
||||
if (!player) {
|
||||
console.log('Could not find player');
|
||||
@ -649,10 +658,10 @@
|
||||
if (player.paused) {
|
||||
return;
|
||||
}
|
||||
const sink = player.mediaSinkManager || player.core?.mediaSinkManager;
|
||||
if (sink?.video?._ffz_compressor) {
|
||||
const sink = player.mediaSinkManager || (player.core ? player.core.mediaSinkManager : null);
|
||||
if (sink && sink.video && sink.video._ffz_compressor) {
|
||||
const video = sink.video;
|
||||
const volume = video.volume ?? player.getVolume();
|
||||
const volume = video.volume ? video.volume : player.getVolume();
|
||||
const muted = player.isMuted();
|
||||
const newVideo = document.createElement('video');
|
||||
newVideo.volume = muted ? 0 : volume;
|
||||
|
Loading…
Reference in New Issue
Block a user