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

Unable to start content playback while ad is playing. #3303

Closed
csati opened this issue Sep 27, 2017 · 6 comments
Closed

Unable to start content playback while ad is playing. #3303

csati opened this issue Sep 27, 2017 · 6 comments
Labels

Comments

@csati
Copy link

csati commented Sep 27, 2017

Issue description

Unable to start content player while ad is playing. If both the IMA ad source and the content source is buffered, a preroll ad would start automatically. After it has been started, the player is in an altered state (refer to ImaAdsLoader.playWhenReadyOverriddenForAds), and the setPlayWhenReady() call does not have an effect on the content.

Reproduction steps

  1. Delay player start to be called during preroll.
    On commit 792f046 (dev-v2 at this moment)
    Apply this diff at PlayerActivity.java:304
-      player.setPlayWhenReady(shouldAutoPlay);
+      mainHandler.postDelayed(new Runnable() {
+        @Override
+        public void run() {
+          player.setPlayWhenReady(shouldAutoPlay);
+        }
+      }, 8000);

  1. Start the demo app with extensions, and select [IMA sample ad tags] / [VMAP pre-roll]

  2. After ad finishes, the last ad frame is visible and player is in paused state. Needs to be started manually. This can be a problem if there is some external event

Link to test content

Test content is included in the demo app.

Version of ExoPlayer being used

Commit 792f046, but also reproducible on release-v2.

Device(s) and version(s) of Android being used

Device independent.

A full bug report captured from the device

N/A.

@andrewlewis
Copy link
Collaborator

I'm not sure I follow the suggestion here. You can setPlayWhenReady(true) before preparing the player with the ads source if you want content to play automatically when the ad finishes.

If playWhenReady is false when an ad starts playing it looks like we currently drop any requests to change the value made while the ad is playing, so perhaps you're reporting this as a bug. This was intentional because the user shouldn't be able to interact with playback controls while an ad is playing. If you have a use case for being able to toggle playWhenReady while an ad is playing, please describe it and we can take a look at changing how this works. Thanks!

@andrewlewis
Copy link
Collaborator

Marking as a bug. The app should be able to set playWhenReady programmatically while an ad is playing and have the state reflected when the content resumes.

@andrewlewis andrewlewis added bug and removed question labels Sep 27, 2017
@csati
Copy link
Author

csati commented Sep 27, 2017

Thank you for the prompt response. For clarification, the use-case is that we want to wait for an external event before starting the content, but want to have it pre-buffered while waiting.

@soadri
Copy link

soadri commented Sep 28, 2017

@csati

This means the content is played after that ads is finished?

@csati
Copy link
Author

csati commented Sep 28, 2017

@soadri

No, the problem is the opposite. If I call setPlayWhenReady(true) while the ad is playing, the state of the content playback is not affected, so it stays paused after the ad has finished.

I would expect the ad video and the content video to be in the same logical state at all times (playing or paused). Maybe I'm looking at it wrong, but that would imply two things:

  1. the preroll ad video should not start without a prior setPlayWhenReady(true) called on the player
  2. after an ad media finishes, and no interaction has been made to the player the content media should start

@andrewlewis
Copy link
Collaborator

We have a potential fix in review that will make setPlayWhenReady work in the same way for ads and content. SimpleExoPlayerView will continue to hide playback controls while playing ads, but controls will be shown (with seeking disabled) if the app pauses the player while it's playing an ad.

ojw28 pushed a commit that referenced this issue Oct 11, 2017
Controls are still hidden while playing ads, but if the app pauses the player,
controls will be shown. During ads, the player is not seekable.

When the player enters the background then returns to the foreground, the
content period may not be prepared, so also cache the content window duration.
This means that if the app reenters the foreground while an ad is paused the
time bar can be populated.

Issue: #3303

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171123428
@ojw28 ojw28 closed this as completed Oct 19, 2017
@google google locked and limited conversation to collaborators Mar 7, 2018
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