PFA: Fix wanted width being ignored on re-updates
This commit is contained in:
parent
0a0b140dd2
commit
4abf817f2a
1 changed files with 14 additions and 3 deletions
|
@ -9,6 +9,8 @@ import JadefinUtils from "../../JadefinUtils.js";
|
|||
|
||||
// Thanks, Mozilla, for killing Firefox... https://bugzilla.mozilla.org/show_bug.cgi?id=1331110
|
||||
export default JadefinIntegrity("PatchFirefoxAnamorphic", import.meta.url, () => new (class PatchFirefoxAnamorphic extends JadefinMod {
|
||||
wantedWidth = 0;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
@ -51,15 +53,22 @@ export default JadefinIntegrity("PatchFirefoxAnamorphic", import.meta.url, () =>
|
|||
}
|
||||
|
||||
if (this.video == video) {
|
||||
return this._dispatch(0);
|
||||
return this._dispatch(this.wantedWidth);
|
||||
}
|
||||
|
||||
const streams = JadefinUtils.currentPlayer?.streamInfo?.mediaSource?.MediaStreams;
|
||||
if (!streams) {
|
||||
this.log.i("Waiting for media streams");
|
||||
setTimeout(() => this.update(), 100);
|
||||
return;
|
||||
}
|
||||
|
||||
this.video = video;
|
||||
|
||||
const ratioStr = JadefinUtils.currentPlayer.streamInfo.mediaSource.MediaStreams.find(s => s.Type == "Video").AspectRatio;
|
||||
const ratioStr = streams.find(s => s.Type == "Video").AspectRatio;
|
||||
const ratioStrSplit = ratioStr && ratioStr.split(":");
|
||||
if (!ratioStrSplit || !ratioStrSplit[1]) {
|
||||
this.log.i(`Aspect ratio couldn't be determined`);
|
||||
this.log.i("Aspect ratio couldn't be determined");
|
||||
return this._dispatch(0);
|
||||
}
|
||||
|
||||
|
@ -81,6 +90,8 @@ export default JadefinIntegrity("PatchFirefoxAnamorphic", import.meta.url, () =>
|
|||
* @param {number} width
|
||||
*/
|
||||
_dispatch(width) {
|
||||
this.wantedWidth = width;
|
||||
|
||||
JadefinUtils.events.dispatchEvent(new CustomEvent("PatchFirefoxAnamorphic", {
|
||||
detail: {
|
||||
width
|
||||
|
|
Loading…
Add table
Reference in a new issue