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.71k stars 409 forks source link

[Google DAI + HLS] Playback is crashed at the ImaServerSideAdInsertionMediaSource #1520

Open devno44 opened 4 months ago

devno44 commented 4 months ago

Version

Media3 1.3.1

More version details

No response

Devices that reproduce the issue

All devices

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Not tested

Reproduction steps

  1. Play the SSAI content (Google DAI + HLS protocol)
  2. While playing the content, when the Ad is played App is crashed.

Expected result

App is not crashed

Actual result

Playback crashes with the following stack trace:

Process: com.xx.qa, PID: 14899 java.lang.IllegalArgumentException
      at androidx.media3.common.util.Assertions.checkArgument(Assertions.java:40)
      at androidx.media3.exoplayer.source.ads.ServerSideAdInsertionMediaSource.setAdPlaybackStates(ServerSideAdInsertionMediaSource.java:179)
      at androidx.media3.exoplayer.ima.ImaServerSideAdInsertionMediaSource.invalidateServerSideAdInsertionAdPlaybackState(ImaServerSideAdInsertionMediaSource.java:790)
      at androidx.media3.exoplayer.ima.ImaServerSideAdInsertionMediaSource.setAdPlaybackState(ImaServerSideAdInsertionMediaSource.java:749)
      at androidx.media3.exoplayer.ima.ImaServerSideAdInsertionMediaSource.access$2300(ImaServerSideAdInsertionMediaSource.java:116)
      at androidx.media3.exoplayer.ima.ImaServerSideAdInsertionMediaSource$SinglePeriodLiveAdEventListener.onAdEvent(ImaServerSideAdInsertionMediaSource.java:1491)
      at androidx.media3.exoplayer.ima.ImaServerSideAdInsertionMediaSource$ComponentListener.onAdEvent(ImaServerSideAdInsertionMediaSource.java:1017)
      at com.google.ads.interactivemedia.v3.impl.zzab.zzb(com.google.ads.interactivemedia.v3:interactivemedia@@3.31.0:25)
      at com.google.ads.interactivemedia.v3.impl.zzbr.zzb(com.google.ads.interactivemedia.v3:interactivemedia@@3.31.0:12)
      at com.google.ads.interactivemedia.v3.impl.zzau.zzl(com.google.ads.interactivemedia.v3:interactivemedia@@3.31.0:50)
      at com.google.ads.interactivemedia.v3.impl.zzbb.zzf(com.google.ads.interactivemedia.v3:interactivemedia@@3.31.0:7)
      at com.google.ads.interactivemedia.v3.impl.zzax.onPostMessage(com.google.ads.interactivemedia.v3:interactivemedia@@3.31.0:2)
      at androidx.webkit.internal.WebMessageListenerAdapter.onPostMessage(WebMessageListenerAdapter.java:55)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.chromium.support_lib_boundary.util.BoundaryInterfaceReflectionUtil$InvocationHandlerWithDelegateGetter.invoke(BoundaryInterfaceReflectionUtil.java:162)
      at java.lang.reflect.Proxy.invoke(Proxy.java:1006)
      at $Proxy13.onPostMessage(Unknown Source)
      at WV.sR.a(chromium-TrichromeWebViewGoogle.aab-stable-647807130:77)
      at WV.hY.run(chromium-TrichromeWebViewGoogle.aab-stable-647807130:28)
      at android.os.Handler.handleCallback(Handler.java:938)
      at android.os.Handler.dispatchMessage(Handler.java:99)
      at android.os.Looper.loopOnce(Looper.java:201)
      at android.os.Looper.loop(Looper.java:288)
      at android.app.ActivityThread.main(ActivityThread.java:7839)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

Media

Not applicable

Bug Report

devno44 commented 4 months ago

This error doesn't happen all the time, it only happens occasionally when the Ad is played, and will probably be difficult to reproduce. Therefore, is there any way to avoid the app crashing after this error occurs? For example, using try-catch?

marcbaechinger commented 4 months ago

Can you provide us with an assetKey to test and repro with?

devno44 commented 4 months ago

@marcbaechinger Like I said before, I'm not sure how it's reproduced, it doesn't happen often, it happens occasionally, and it's not always reproducible. This crash is also reported a lot on firebase from our users, but we don't know how to investigate what the cause is.

marcbaechinger commented 4 months ago

Thanks for your response. I understand it doesn't repro easily but without having a stream that is producing the problem, it is hard for me to do something.

An assetKey of a stream that produces the problem would make this issue actionable for me. If you're unable to share test content publicly, please send them to android-media-github@google.com using a subject in the format "Issue #1520". Please also update this issue to indicate you’ve done this.

devno44 commented 4 months ago

@marcbaechinger Thank you, I will discuss with my team about creating a content for testing. But before that, is there any solution that can avoid that error? At least it won't cause the app to crash ?

marcbaechinger commented 4 months ago

Therefore, is there any way to avoid the app crashing after this error occurs? For example, using try-catch?

I don't think so. The assertion is set at the place where the problem starts. If we catch it there, it would crash some later without us knowing exactly where it started.

We'll look into this when we have the media.

alpha4041 commented 3 months ago

I have this problem since 2 days after something upgraded in my device. All apps that use rewarded ads crash for me. Will post a logcat after it happens again.