google / ExoPlayer

This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media
https://developer.android.com/media/media3/exoplayer
Apache License 2.0
21.74k stars 6.03k forks source link

ArrayIndexOutOfBoundsException in ImaAdsLoader.updateImaStateForPlayerState #6425

Closed rockex6 closed 4 years ago

rockex6 commented 5 years ago

we have videos with ads in our app, and we have ArrayIndexOutOfBoundsException in the ima extension. We don't have a specific scenario for this crash and it happens randomly on many devices. I attach the stack trace below:

Fatal Exception: java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
       at com.google.android.exoplayer2.ext.ima.ImaAdsLoader.updateImaStateForPlayerState + 1186(ImaAdsLoader.java:1186)
       at com.google.android.exoplayer2.ext.ima.ImaAdsLoader.onTimelineChanged + 962(ImaAdsLoader.java:962)
       at com.google.android.exoplayer2.ExoPlayerImpl$PlaybackInfoUpdate.lambda$run$0$ExoPlayerImpl$PlaybackInfoUpdate + 790(ExoPlayerImpl.java:790)
       at com.google.android.exoplayer2.-$$Lambda$ExoPlayerImpl$PlaybackInfoUpdate$N_S5kRfhaRTAkH28P5luFgKnFjQ.invokeListener + 2(:2)
       at com.google.android.exoplayer2.BasePlayer$ListenerHolder.invoke + 165(BasePlayer.java:165)
       at com.google.android.exoplayer2.ExoPlayerImpl.invokeAll + 823(ExoPlayerImpl.java:823)
       at com.google.android.exoplayer2.ExoPlayerImpl.access$000 + 43(ExoPlayerImpl.java:43)
       at com.google.android.exoplayer2.ExoPlayerImpl$PlaybackInfoUpdate.run + 787(ExoPlayerImpl.java:787)
       at com.google.android.exoplayer2.ExoPlayerImpl.notifyListeners + 726(ExoPlayerImpl.java:726)
       at com.google.android.exoplayer2.ExoPlayerImpl.updatePlaybackInfo + 701(ExoPlayerImpl.java:701)
       at com.google.android.exoplayer2.ExoPlayerImpl.handlePlaybackInfo + 648(ExoPlayerImpl.java:648)
       at com.google.android.exoplayer2.ExoPlayerImpl.handleEvent + 598(ExoPlayerImpl.java:598)
       at com.google.android.exoplayer2.ExoPlayerImpl$1.handleMessage + 126(ExoPlayerImpl.java:126)
       at android.os.Handler.dispatchMessage + 106(Handler.java:106)
       at android.os.Looper.loop + 193(Looper.java:193)
       at android.app.ActivityThread.main + 6718(ActivityThread.java:6718)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run + 493(RuntimeInit.java:493)
       at com.android.internal.os.ZygoteInit.main + 858(ZygoteInit.java:858)

my version is 2.10.3 and I used google pixel 3XL android 9.0

google-oss-bot commented 5 years ago

This issue does not seem to follow the issue template. Make sure you provide all the required information.

andrewlewis commented 5 years ago

In 2.10.3 the access here is throwing as there don't appear to be any ad groups, yet the player thinks it's playing an ad. Do you have any clues about what might be triggering this? Can you share a sample ad tag where this issue was seen (with dev.exoplayer@gmail.com if you don't want to post it here)? Thanks.

rockex6 commented 5 years ago

In 2.10.3 the access here is throwing as there don't appear to be any ad groups, yet the player thinks it's playing an ad. Do you have any clues about what might be triggering this? Can you share a sample ad tag where this issue was seen (with dev.exoplayer@gmail.com if you don't want to post it here)? Thanks.

thanks for reply. I got this error again a few days ago. maybe when ad is ready to play but I finish activity and release the player?

this is the sample ima ad code here: https://pubads.g.doubleclick.net/gampad/ads?iu=/21685920852/setn_video_pre-roll_1280x720_2&cust_params=pagegroupid%3D{0}&description_url=[placeholder]&env=vp&impl=s&correlator=&tfcd=0&npa=0&gdfp_req=1&output=vast&sz=1280x720&unviewed_position_start=1&ppos=1[timestamp]

andrewlewis commented 4 years ago

I haven't seen this error while testing various ad tags with the new IMA SDK preloading APIs (fa7d26dd9f94f52c412ff7d6490630dd73f187a6), and that change should be in a release soon. I will mark this as closed for now but please reply here or file a new issue if you can still reproduce this after that change.