Skip to content

Commit

Permalink
🐛 [Connatix Player] - Fix player not unmuting while docking (#39792)
Browse files Browse the repository at this point in the history
* fix player not being able to unmute while docking

* volume fix
  • Loading branch information
cristisilav authored Feb 2, 2024
1 parent 4725f3b commit 4fdf6a7
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions extensions/amp-connatix-player/0.1/amp-connatix-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ import {
getConsentPolicySharedData,
getConsentPolicyState,
} from '../../../src/consent';
import {mutedOrUnmutedEvent, redispatch} from '../../../src/iframe-video';
import {
addUnsafeAllowAutoplay,
mutedOrUnmutedEvent,
redispatch,
} from '../../../src/iframe-video';
import {addParamsToUrl} from '../../../src/url';
import {
VideoEvents_Enum,
Expand Down Expand Up @@ -179,6 +183,14 @@ export class AmpConnatixPlayer extends AMP.BaseElement {
this.isFullscreen_ = !this.isFullscreen_;
break;
}
case 'cnxVolumeChanged': {
const newVolume = dataJSON['args'];

this.muted_ = newVolume === 0;
dispatchCustomEvent(this.element, mutedOrUnmutedEvent(this.muted_));

break;
}
}

redispatch(this.element, dataJSON['func'].toString(), {
Expand Down Expand Up @@ -321,6 +333,7 @@ export class AmpConnatixPlayer extends AMP.BaseElement {

// applyFillContent so that frame covers the entire component.
applyFillContent(iframe, /* replacedContent */ true);
addUnsafeAllowAutoplay(iframe);

// append child iframe for element
element.appendChild(iframe);
Expand Down Expand Up @@ -432,15 +445,11 @@ export class AmpConnatixPlayer extends AMP.BaseElement {

/** @override */
mute() {
this.muted_ = true;
dispatchCustomEvent(this.element, mutedOrUnmutedEvent(this.muted_));
this.sendCommand_('mute');
}

/** @override */
unmute() {
this.muted_ = false;
dispatchCustomEvent(this.element, mutedOrUnmutedEvent(this.muted_));
this.sendCommand_('unmute');
}

Expand Down

0 comments on commit 4fdf6a7

Please sign in to comment.