Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird behaviour when seek operation is performed while playing preroll ad. #8349

Closed
sravan1213 opened this issue Dec 14, 2020 · 3 comments
Closed
Assignees
Labels

Comments

@sravan1213
Copy link
Contributor

sravan1213 commented Dec 14, 2020

Steps to Reproduce.

  1. Play any video with preroll.
  2. Seek when player is in ready state. Please add following code in PlayerListener of demo app
 @Override
    public void onPlaybackStateChanged(@Player.State int playbackState) {
      if (playbackState == Player.STATE_READY) {
        player.seekTo(20_000);
      }
}

Observe player goes into weird state. Ad gets skipped and play randomly along with content.

100% reproducible on latest version of exo-player.

I understand exoplayer doesn't support seek during ads, but there is already a warning for this. performing this operation should not cause this issue.

@krocard
Copy link
Contributor

krocard commented Dec 15, 2020

I have added the seek on STATE_READY in the demo app but the seek was ignored as expected:

D/EventLogger: state [eventTime=0.90, mediaPos=0.00, window=0, period=0, adGroup=0, ad=0, READY]
D/EventLogger: seekStarted [eventTime=0.90, mediaPos=0.00, window=0, period=0, adGroup=0, ad=0]
W/ExoPlayerImpl: seekTo ignored because an ad is playing

Please provide the media with the prerolled media so we can reproduce and a bug report.

If you're unable to share bug reports or test content publicly, please send them to dev.exoplayer@gmail.com using a subject in the format "Issue #1234" ("#1234" is replaced with your issue number). Please also update this issue to indicate you've done this.

@krocard krocard self-assigned this Dec 15, 2020
@sravan1213
Copy link
Contributor Author

sravan1213 commented Dec 16, 2020

Hi @krocard ,

Attached video and logs for reference. In the video you can observe first preroll is completed before second preroll started and video got stuck at 1st mid-roll.

Also attaching patch for seek logic.

Hope this helps
issue_8349.zip

@krocard
Copy link
Contributor

krocard commented Dec 16, 2020

Thank you, I managed to reproduce the issue.

The issue is due to pendingOperationAcks being incremented even if the seek is ignored. When the seek is ignored, an updatedPlaybcak info is sent with an operationAcks of 0.

pendingOperationAcks++;
if (isPlayingAd()) {
// TODO: Investigate adding support for seeking during ads. This is complicated to do in
// general because the midroll ad preceding the seek destination must be played before the
// content position can be played, if a different ad is playing at the moment.
Log.w(TAG, "seekTo ignored because an ad is playing");
playbackInfoUpdateListener.onPlaybackInfoUpdate(
new ExoPlayerImplInternal.PlaybackInfoUpdate(playbackInfo));
return;
}

This lead to ExoPlayer considering that an operation is still in flight, and playbackInfo is no longer updated.

We could call incrementPendingOperationAcks(1) on the sent PlaybackInfoUpdate, but I'm not sure it is the right thing to do because it also sets hasPendingChange, which is not true.

This regression was introduced by b1e9257 in 2.12.0.

@icbaker could you take a look.

@krocard krocard removed their assignment Dec 16, 2020
christosts pushed a commit that referenced this issue Dec 17, 2020
This regression was introduced in
b1e9257

Issue: #8349

#minor-release

PiperOrigin-RevId: 347802049
@icbaker icbaker closed this as completed Dec 21, 2020
icbaker added a commit that referenced this issue Jan 11, 2021
This regression was introduced in
b1e9257

Issue: #8349

PiperOrigin-RevId: 347802049
@google google locked and limited conversation to collaborators Feb 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants