-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add method to reset ad group to be played again. #9615
Comments
I'm not aware of any removed methods that no longer work, so I think whatever you are planning to do in the old code should still work the same in the new code. A general note in that regard: It's unclear what you are trying to achieve exactly and usually we don't expect apps to update
Using |
There is no ability to set AdGroup at specific index in the new version. In 2.13.2 we can call |
|
Use case is described in issue 8810 and I shared you our code. I can share you our current code that we are using in 2.15.1. Is that what would help? |
Issue #8810 is about marking an ad as skipped, which can be achieved with |
Yes, we are doing that, but to mark them available, we were call |
I'm not sure I understand which part is missing or not working.
|
URI of an ad is not available at the moment. We need to set |
If the URI of the ad is not yet available, then you can't mark the ad as available because it would violate state assumption we have about Other modifications are allowed: You can add new ads in the group, you can set the ad durations, you can set the state to played/skipped/error, or provide an URI to set the state back to available. |
URIs of all
This was available in previous versions of ExoPlayer with standard API. There was not needed reflection until version 2.15.1. |
There is no "ready to load" state I think because you'd need to either reset it to UNAVAILABLE or AVAILABLE, depending on whether the ad URI has already been set. So to clarify, you need a method to reset the final ad states (SKIPPED, ERROR, PLAYED) back to (UNAVAILABLE or AVAILABLE), allowing the player to pick up the ad again for playback the next time it plays at this position. The method would look something like
That was never a valid API we intended to be used. It's more of an oversight that let you modify array elements that should have unmodifiable. |
Yes, method like |
It wouldn't :). The method would keep ad count, ad URIs, the ad group time and known ad durations. But if I understand the requirements correctly, this is also what you need to reset the skipped state. |
If I remember correctly, there was some Exo/IMA code that requires exactly that state. Maybe empty |
I tested setting all ads to SKIPPED initially (to prevent playing them although they are loaded) and then after a while I reset just their state back to AVAILABLE (keeping all other values). After this point they started playing again as expected, so I think such a method would solve the general problem of resetting ads. Depending on your customization of the ads loader, it could be that you need to update the states in more places or make sure IMA receives the expected positions etc., but that's down to your app customization and we can't provide detailed advise on how to customize the components correctly. The enhancement tracked by #8810 is also still not solved, so you might see short rebufferings when you change the ad state while the previous content piece is already playing. |
Glad to hear it, thanks.
Yes, I know. We are keeping track with the original IMA extension, but our version has a lot of modifications to "solve" save instance state, our smart seek feature, delayed responses, UI customizations, ... |
The player will not play ads in final states (played, skipped, error) again. To allow ads loader customizations to play ads again, we can add a method that resets the state back to available or unavailable (depending on whether we have the URI for the ad). Issue: #9615 PiperOrigin-RevId: 411042842
Added the method in the commit above. Closing this issue accordingly. |
The player will not play ads in final states (played, skipped, error) again. To allow ads loader customizations to play ads again, we can add a method that resets the state back to available or unavailable (depending on whether we have the URI for the ad). Issue: google/ExoPlayer#9615 PiperOrigin-RevId: 411042842
We are updating ExoPlayer in our project from version 2.13.2 to 2.15.1. We are using modified IMA extension because of feature described in issue 8810. We had to change
adPlaybackState.adGroups[i] = AdPlaybackState.AdGroup().withAdCount(1).withAdState(AdPlaybackState.AD_STATE_PLAYED, 0)
toadPlaybackState = adPlaybackState.withNewAdGroup(i, timeUs).withAdCount(i, 1).withPlayedAd(i, 0)
andadPlaybackState.adGroups[i] = AdPlaybackState.AdGroup()
toadPlaybackState = adPlaybackState.withNewAdGroup(i, adTimeUs)
. But it looks like there are some internal changes and our application is crashing in newly added check on line 285 in AdsMediaSource that was not in 2.13.2 version.Could you please help us how to set
AdGroup
directly intoAdPlaybackState.adGroups
and avoid increasing theAdPlaybackState.adGroupCount
? Our code is in Kotlin language and we created extensionAdPlaybackState.setAdGroup(index: Int, adGroup: AdPlaybackState.AdGroup)
that is using reflection to set anAdGroup
intoAdPlaybackState.adGroups
. But using reflection is not the best solution. Thanks!The text was updated successfully, but these errors were encountered: