googleads / videojs-ima

IMA SDK Plugin for Video.js
Apache License 2.0
450 stars 284 forks source link

2 clicks required to resume video in mobile browsers after clicking "Learn More" button #865

Closed tonyjose009 closed 4 years ago

tonyjose009 commented 4 years ago

Hello,

I'm playing the video as inline using, playsinline. So in this case, when the user clicks the "Learn More" button, the user will be redirected to click URL and the player will be paused by default.

If the user wants to resume the video again, the user has to click 2 times on the play button.

If he clicks on the player, the video resumes immediately. I found this issue only with "play" button and this is applicable for both iOS and Android browsers.

You can replicate the issue by adding "playsinline" attribute in the below example:

https://googleads.github.io/videojs-ima/examples/simple/

<video id="content_video" class="video-js vjs-default-skin"
            poster = "../posters/bbb_poster.jpg" controls preload="auto"
            width="640" height="360" playsinline muted="muted">
          <source src="//commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
              type="video/mp4" ></source>
        </video>

It would be great if anyone can help to fix this issue

Kiro705 commented 4 years ago

Hi @tonyjose009 ,

Thanks for finding this bug. I have a fix for the issue in this https://github.com/googleads/videojs-ima/pull/866

Once it is merged we can confirm it is a fix for your build.

tonyjose009 commented 4 years ago

Thanks, @Kiro705 , Anyhow I have managed to resolve this issue in "onAdPlayPauseClick" function.

Anyways it would be great if you can confirm it

Kiro705 commented 4 years ago

This "onAdPlayPauseClick"?

Controller.prototype.onAdPlayPauseClick = function () {
  if (this.sdkImpl.isAdPlaying()) {
    this.adUi.onAdsPaused();
    this.sdkImpl.pauseAds();
  } else {
    this.adUi.onAdsPlaying();
    this.sdkImpl.resumeAds();
  }
};

I found the issue was in the pause from the clickthru not properly updating this.sdkImpl.isAdPlaying(). The change should fix that. I will update here when the change is live.

Kiro705 commented 4 years ago

Issue should be fixed in the new release v1.7.3

Closing the issue, but feel free to reopen if it persists.

tonyjose009 commented 4 years ago

Cool, it's working. Thank you @Kiro705 for the fix.