Closed nikky12 closed 7 months ago
I think this is essentially a duplicate of https://github.com/google/ExoPlayer/issues/3693.
For your workaround case: Do you need to play the same content with your 'ads' player? What about playing some 'fake' local content, since I believe you will only actually be using this player when it's playing ads - that should avoid you downloading the content twice.
@icbaker @tonihei Yes, i need to play the ads on same content. So video url, we are giving to ads player should be of same duration, how would it be possible to play a fake media source? Every video can of different duration, where would i get the fake video Also there is no API to set fake media item with val adsConfig = MediaItem.AdsConfiguration.Builder(adTagUri).build() val mediaItem: MediaItem = MediaItem.Builder() .setUri(contentUri) .setAdsConfiguration(adsConfig) .build()
// Prepare the content and ad to be played with the SimpleExoPlayer.
imaAdsPlayer?.setMediaItem(mediaItem)
imaAdsPlayer?.prepare()
where would i get the fake video
You can use a SilenceMediaSource
and then configure the player with an AdsMediaSource
directly instead of using MediaItem
. It should look roughly like this:
player.addMediaSource(
new AdsMediaSource(
new SilenceMediaSource(/* durationUs= */ [value >= last ad group time]),
new DataSpec(adTagUri),
/* adsId= */ "ads",
new DefaultMediaSourceFactory(context),
adsLoader,
adViewProvider));
I assume the question was answered and will close the issue.
Version
ExoPlayer 2.16.1
More version details
No response
Devices that reproduce the issue
All Android devices
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Yes
Reproduction steps
We are using IMA SDK for playing video ads. We have tried with Single player and using Concatenating media source to have Ads and content media concatenated. But due to this issue https://github.com/google/ExoPlayer/issues/3693, we have to switch to two players One player used for content playback and another is for Ads playback.
Content Player
Ads Player
Ima Ads player needs two media items - content and ad tag url Since there are two players, two tracks are getting downloaded for content playback. One track in the quality user has selected to play and another that is with Adsplayer.
Do we have a fix for the issue which i mentioned https://github.com/google/ExoPlayer/issues/3693 So that we can move to single player.
Expected result
Below Exception should not come when i use ConcatenatingMediaSource with Ads and content url .
Actual result
Above exception is coming
Media
Not applicable
Bug Report
adb bugreport
to android-media-github@google.com after filing this issue.