androidx / media

Jetpack Media3 support libraries for media use cases, including ExoPlayer, an extensible media player for Android
https://developer.android.com/media/media3
Apache License 2.0
1.67k stars 397 forks source link

ExoPlayer 2.19.1 is processing ad metadata when playWhenReady is false. #809

Open dustinpreble opened 11 months ago

dustinpreble commented 11 months ago

I am in the process of updating an app from ExoPlayer 2.15.1 to 2.19.1.

The streams we are using have ad metadata at the very beginning of them. The app relies on a 3rd party sdk for its live streams and ad management and that sdk needs to be initialized fully before metadata can be processed. In 2.15.1 we achieved this by setting playWhenReady to false until the 3rd party SDK was ready. Once the sdk is ready, we set ExoPlayer.playWhenReady to true and then we see the ad metadata be processed. However, in 2.19.1, even after setting ExoPlayer.playWhenReady to false, we are seeing metadata being processed. Is this expected? If it is, is there a way to stop metadata processing in ExoPlayer 2.19.1?

marcbaechinger commented 11 months ago

What type of stream is this? Can you provide us with such a stream so we can look into this? 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 #809". Please also update this issue to indicate you’ve done this.

Is this expected?

Without looking I'd say that the metadata that has a timestamp smaller than the current position would be emited immediately. I've seen this with DASH live streams when implementing server side ads, where this behaviour was useful. SO having the media would be helpful so we can see what timestamps the metadata has and whether ExoPlayer behaves sensible.

If it is, is there a way to stop metadata processing in ExoPlayer 2.19.1?

If the timestamps are correct and indicate to deliver the metadata because they are before the current position, then probably not. How is the SDK getting the metadata? If your app is in between it should be possible to 'buffer' the metadata until the SDK is ready and then deliver as soon as it got ready?

Best would be to have the mediaa for investigation.

dustinpreble commented 11 months ago

I can't provide the media unfortunately, but it is an HLS stream with server side ad injection. You are correct that our currentPosition is past the metadata's timestamp, however, this is also true when we were on 2.15.1.