In our code we had this part
new AdsMediaSource(SilenceMediaSource(0), sourceFactory, adsLoader, playerView);
which was working fine with ExoPlayer version 2.11.8
In order to launch standalone IMA preroll and then when it finishes launch another player which might not be ExoPlayer. So we relied on correct callback which is called
Steps to reproduce
- Modify
media.exolist.json
"name": "TuneIn sample",
"uri": "https://storage.googleapis.com/exoplayer-test-media-1/mkv/android-screens-lavf-56.36.100-aac-avc-main-1280x720.mkv",
"ad_tag_uri": "https://pubads.g.doubleclick.net/gampad/ads?iu=/15480783/Mobile-Preroll-Video/Android&correlator=1608131292462&env=vp&impl=s&url=tunein.player&gdfp_req=1&output=vast&unviewed_position_start=1&ciu_szs=300x250&description_url=https%3A%2F%2Ftunein.com%2Fdesc%2Fs250018%2F&sz=1x1%7C400x300%7C640x360%7C640x480&us_privacy=1YNY&gdpr=0&gdpr_consent=&cust_params=useragent%3DTuneIn+Radio-25.8+%28Android-30%3B+Pixel+3%3B+Java%29%26partnerId%3DxwhZkVKi%26ListingId%3Ds250018%26genre_id%3Dg4136%26class%3Dmusic%26stationId%3Ds250018%26is_mature%3Dfalse%26is_family%3Dfalse%26is_event%3Dfalse%26is_ondemand%3Dfalse%26language%3Den_US%26version%3D25.8%26persona%3DMusic%26is_new_user%3Dfalse%26device%3Dphone%26country_region_id%3D100436%26videoEnabled%3Dtrue%26audioEnabled%3Dtrue%26station_language%3DEnglish%26categoryId%3Dhome%26screen%3Dnowplaying%26isFirstInSession%3Dtrue%26videoPrerollPlayed%3Dfalse%26unlockEnabled%3Dtrue%26nflUnlocks%3D0%26isUnlocked%3Dfalse%26lotamesegments%3DVP1%2CW12%2CPHY%2CBLK%2CW07%2CVM3%2CVB3%2CVM1%2CVB1%2C890%2CVC1%2CW17%2CVJ2%2CVF3%2CW09%2Cx740x%2CW05%2CPYT%2CVF4%2CVE3%2Cx1x%2CxAMx%2CVNG%2CW14%2CVF2%2CPHIF%2CVA2%2CW22%2Cx848x%2CVN4%2Cx620x%2CVF6%2CW02%2CW21%2CW08%2CVN6%2CBE%2Cx809x%2C492%2CVP6%26premium%3Dfalse%26msid%3Dtunein.player"
- Replace this part in the ExoPlayer Demo project
return new AdsMediaSource(
new SilenceMediaSource(1), // instead of mediaSource,
new DataSpec(adTagUri),
/* adMediaSourceFactory= */ this,
adsLoader,
adViewProvider);
}
- Select build variant with extensions
- Enable debugging logging for ImaAdsLoader
- Launch new added IMA sample tag and wait till the end.
- Observe logs. ExoPlayer throws
onPlayerError() called with: error = [com.google.android.exoplayer2.ExoPlaybackException: Unexpected runtime error]" and ImaAdsLoader receives PAUSE callback instead of COMPLETED
2020-12-18 17:01:50.561 20546-20546/com.google.android.exoplayer2.demo D/ImaAdsLoader: Ad progress: 28406 ms of 28952 ms
2020-12-18 17:01:50.663 20546-20546/com.google.android.exoplayer2.demo D/ImaAdsLoader: Ad progress: 28507 ms of 28952 ms
2020-12-18 17:01:50.747 20546-20546/com.google.android.exoplayer2.demo D/ImaAdsLoader: pauseAd AdMediaInfo[https://cdn-cms.tunein.com/ads/Lizzie/INTEL%20_%20MADE%20120120.mp3, (0, 0)]
2020-12-18 17:01:50.777 20546-20546/com.google.android.exoplayer2.demo D/ImaAdsLoader: Ad progress: 28578 ms of 28952 ms
2020-12-18 17:01:50.811 20546-20546/com.google.android.exoplayer2.demo D/ImaAdsLoader: onAdEvent: PAUSED
- ExoPlayer version number = 2.12.2
- IMA SDK = 3.21.4
- Android version = 11
- Android device = Pixel 3
UPDATE:
Passing new SilenceMediaSource(TimeUnit.SECONDS.toMicros(1)) solves the problem.
Proposed solution:
throw an error if duration of SilenceMediaSource isn't enough for player to actually play it.
In our code we had this part
which was working fine with ExoPlayer version 2.11.8
In order to launch standalone IMA preroll and then when it finishes launch another player which might not be ExoPlayer. So we relied on correct callback which is called
Steps to reproduce
media.exolist.jsononPlayerError() called with: error = [com.google.android.exoplayer2.ExoPlaybackException: Unexpected runtime error]" andImaAdsLoaderreceives PAUSE callback instead of COMPLETEDUPDATE:
Passing
new SilenceMediaSource(TimeUnit.SECONDS.toMicros(1))solves the problem.Proposed solution:
throw an error if duration of
SilenceMediaSourceisn't enough for player to actually play it.