mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-06-27 21:05:53 +00:00
4.33.3
* Fixed: Attempt to resume a suspended audio context before giving up.
This commit is contained in:
parent
3291b95e55
commit
4b5827f98b
2 changed files with 22 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "frankerfacez",
|
"name": "frankerfacez",
|
||||||
"author": "Dan Salvato LLC",
|
"author": "Dan Salvato LLC",
|
||||||
"version": "4.33.2",
|
"version": "4.33.3",
|
||||||
"description": "FrankerFaceZ is a Twitch enhancement suite.",
|
"description": "FrankerFaceZ is a Twitch enhancement suite.",
|
||||||
"private": true,
|
"private": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
|
|
@ -1533,15 +1533,33 @@ export default class PlayerBase extends Module {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
createCompressor(inst, video) {
|
createCompressor(inst, video, _cmp) {
|
||||||
if ( ! this.canCompress(inst) )
|
if ( ! this.canCompress(inst) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let comp = video._ffz_compressor;
|
let comp = video._ffz_compressor;
|
||||||
if ( ! comp ) {
|
if ( ! comp ) {
|
||||||
const ctx = new AudioContext();
|
const ctx = _cmp || new AudioContext();
|
||||||
if ( ! IS_FIREFOX && ctx.state === 'suspended' ) {
|
if ( ! IS_FIREFOX && ctx.state === 'suspended' ) {
|
||||||
this.log.info('Aborting due to browser auto-play policy.');
|
let timer;
|
||||||
|
const evt = () => {
|
||||||
|
clearTimeout(timer);
|
||||||
|
ctx.removeEventListener('statechange', evt);
|
||||||
|
if (ctx.state === 'suspended') {
|
||||||
|
this.log.info('Aborting due to browser auto-play policy.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.createCompressor(inst, video, comp);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.log.info('Attempting to resume suspended AudioContext.');
|
||||||
|
timer = setTimeout(evt, 100);
|
||||||
|
try {
|
||||||
|
ctx.addEventListener('statechange', evt);
|
||||||
|
ctx.resume();
|
||||||
|
} catch(err) { }
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue