Skip to content

Commit

Permalink
♻️ Name amp-ima-video methods uniformly for Bento (ampproject#34246)
Browse files Browse the repository at this point in the history
Rename `postMessage` method names so that they're uniform with `VideoIframe`'s. This simplifies the upcoming Bento implementation.
  • Loading branch information
alanorozco authored and rochapablo committed Aug 30, 2021
1 parent a290ccd commit 096169b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions ads/google/imaVideo.js
Original file line number Diff line number Diff line change
Expand Up @@ -1470,21 +1470,21 @@ function onMessage(global, event) {
return;
}
switch (msg['func']) {
case 'playVideo':
case 'play':
if (adsActive || playbackStarted) {
playVideo();
} else {
// Auto-play support
onBigPlayClick(global);
}
break;
case 'pauseVideo':
case 'pause':
pauseVideo();
break;
case 'mute':
muteVideo();
break;
case 'unMute':
case 'unmute':
unmuteVideo();
break;
case 'hideControls':
Expand Down Expand Up @@ -1526,7 +1526,7 @@ function onMessage(global, event) {
requestAds();
}
break;
case 'enterFullscreen':
case 'requestFullscreen':
if (fullscreen) {
return;
}
Expand Down
8 changes: 4 additions & 4 deletions extensions/amp-ima-video/0.1/amp-ima-video.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,12 +347,12 @@ class AmpImaVideo extends AMP.BaseElement {

/** @override */
play(unusedIsAutoplay) {
this.sendCommand_('playVideo');
this.sendCommand_('play');
}

/** @override */
pause() {
this.sendCommand_('pauseVideo');
this.sendCommand_('pause');
}

/** @override */
Expand All @@ -362,7 +362,7 @@ class AmpImaVideo extends AMP.BaseElement {

/** @override */
unmute() {
this.sendCommand_('unMute');
this.sendCommand_('unmute');
}

/** @override */
Expand All @@ -377,7 +377,7 @@ class AmpImaVideo extends AMP.BaseElement {

/** @override */
fullscreenEnter() {
this.sendCommand_('enterFullscreen');
this.sendCommand_('requestFullscreen');
}

/** @override */
Expand Down

0 comments on commit 096169b

Please sign in to comment.