Skip to content

Commit

Permalink
added updateMutedAttribute
Browse files Browse the repository at this point in the history
  • Loading branch information
edsilv committed Jan 17, 2025
1 parent 22ff0ce commit ff2809d
Showing 1 changed file with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,7 @@ export class MediaElementCenterPanel extends CenterPanel<
this.extensionHost.subscribe(IIIFEvents.SET_MUTED, (muted: boolean) => {
if (that.player) {
that.player.setMuted(muted);

if (muted) {
that.$media.attr("muted", "");
} else {
that.$media.removeAttr("muted");
}
that.updateMutedAttribute(muted);
}
});

Expand All @@ -133,6 +128,14 @@ export class MediaElementCenterPanel extends CenterPanel<
this.title = this.extension.helper.getLabel();
}

updateMutedAttribute(muted: boolean) {
if (muted) {
this.$media.attr("muted", "");
} else {
this.$media.removeAttr("muted");
}
}

async openMedia(resources: IExternalResource[]) {
const that = this;

Expand Down Expand Up @@ -284,10 +287,13 @@ export class MediaElementCenterPanel extends CenterPanel<

if (that.muted === true && muted === false) {
that.muted = false;

that.extensionHost.fire(
MediaElementExtensionEvents.MEDIA_UNMUTED
);
}

that.updateMutedAttribute(that.muted);
});
},
});
Expand Down Expand Up @@ -372,6 +378,8 @@ export class MediaElementCenterPanel extends CenterPanel<
MediaElementExtensionEvents.MEDIA_UNMUTED
);
}

that.updateMutedAttribute(that.muted);
});
},
});
Expand Down

0 comments on commit ff2809d

Please sign in to comment.