1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-06-27 21:05:53 +00:00
* Changed: Update another method used in the audio compressor to use a newer API when available.
This commit is contained in:
SirStendec 2022-04-25 14:19:34 -04:00
parent 3ea07abb0e
commit 3291b95e55
2 changed files with 23 additions and 6 deletions

View file

@ -1,7 +1,7 @@
{
"name": "frankerfacez",
"author": "Dan Salvato LLC",
"version": "4.33.1",
"version": "4.33.2",
"description": "FrankerFaceZ is a Twitch enhancement suite.",
"private": true,
"license": "Apache-2.0",

View file

@ -1419,12 +1419,21 @@ export default class PlayerBase extends Module {
return;
if ( want_gain && ! gain ) {
gain = video._ffz_gain = ctx.createGain();
let value = video._ffz_gain_value;
if ( value == null )
value = this.settings.get('player.gain.default');
gain.gain.value = value;
try {
gain = video._ffz_gain = new GainNode(ctx, {
gain: value
});
} catch(err) {
this.log.info('Unable to use new GainNode. Falling back to old method.');
gain = video._ffz_gain = ctx.createGain();
gain.gain.value = value;
}
comp.connect(gain);
if ( compressed ) {
@ -1537,14 +1546,22 @@ export default class PlayerBase extends Module {
}
video._ffz_context = ctx;
const src = video._ffz_source = ctx.createMediaElementSource(video);
let src;
try {
src = video._ffz_source = new MediaElementAudioSourceNode(ctx, {
mediaElement: video
});
} catch(err) {
this.log.info('Unable to use new MediaElementAudioSourceNode. Falling back to old method.');
src = video._ffz_source = ctx.createMediaElementSource(video);
}
src.connect(ctx.destination);
try {
comp = video._ffz_compressor = new DynamicsCompressorNode(ctx);
} catch (err) {
this.log.info('Unable to uew new DynamicsCompressorNode. Falling back to old method.');
this.log.info('Unable to use new DynamicsCompressorNode. Falling back to old method.');
comp = video._ffz_compressor = ctx.createDynamicsCompressor();
}
@ -1560,7 +1577,7 @@ export default class PlayerBase extends Module {
});
} catch(err) {
this.log.info('Unable to uew new GainNode. Falling back to old method.');
this.log.info('Unable to use new GainNode. Falling back to old method.');
gain = video._ffz_gain = ctx.createGain();
gain.gain.value = value;
}