Open Manvendra-Jadon opened 4 years ago
I found this already logged issue: #4232 But this was logged in 2018. I want to know, if it is possible to add the same now.
This hasn't changed: we still rely on the cue points provided by the IMA SDK via the AdsManager
for VMAP, and for VAST we assume a single preroll. As your example includes multiple cue points I assume we are talking about a VMAP ad tag here.
Google IMA SDK for iOS provides this way of adding cue points. Can we make it possible on exoplayer-ima-extension if not already feasible?
Please could you point me to the API for this? If there's an API in the IMA SDK for Android I think we can start using it from the extension. If it's only available on iOS we'd need to get it added to the Android API.
I have a related issue. I already implemented my own cue points, but with ExoPlayer 2.12.0 I lost the ability to easily access com.google.ads.interactivemedia.v3.api.AdsLoader
from ImaAdsLoader
.
The problem is that I cannot set addAdsLoadedListener
which I used to receive adCuePoints (obtained from AdsManagerLoadedEvent.adsManager.adCuePoints
).
This is because at the time ImaAdsLoader calls DefaultMediaSourceFactory.AdsLoaderProvider.getAdsLoader()
(or more specifically, at the time I just created an instance with buildForAdTag
), the internal adsLoader is null.
I suppose I could try adding the listener elsewhere, but maybe I can get the cue points in a better way?
I suppose I could try adding the listener elsewhere, but maybe I can get the cue points in a better way?
The ad cue points are exposed via the player's Timeline
. Here is an example of logging them in the timeline changed callback:
@Override
public void onTimelineChanged(Timeline timeline, int reason) {
if (timeline.isEmpty()) {
return;
}
Timeline.Period period = timeline.getPeriod(player.getCurrentPeriodIndex(), new Timeline.Period());
long[] adGroupTimesUs = new long[period.getAdGroupCount()];
for (int i = 0; i < adGroupTimesUs.length; i++) {
adGroupTimesUs[i] = period.getAdGroupTimeUs(i);
}
// Do something with adGroupTimesUs ...
}
The negative value C.TIME_END_OF_SOURCE
means a postroll. This event is triggered whenever the structure of the media changes (for example, when an ad is marked as played to the end), so, depending on what you are using the information for you, may need to ensure whatever code handles the events runs only when the ad group times become known for the first time.
I'm curious what you mean by implementing your own cue points -- do you know of an API for doing this that we are not currently using? Or are you building a custom ads response and passing that to the extension? Or something else? Thanks.
@Manvendra-Jadon A couple of follow-ups based on #8094:
ImaAdsLoader.requestAds
(you can call that before creating the AdsMediaSource
and player).@andrewlewis Thanks for the quick reply.
Good to know that we can pre-fetch ads. But can we play them when we want to. Also, we might differ on pre-fetching thing. Here is what pre-fetching i meant: e.g. like there are 5 cue points at 30 sec, 60 sec, 90 sec, 120 sec, 150 sec , i need to add a mid-roll at these points. So what i want to do is prefetch ads for all positions and show them at these positions. Is that thing possible as of now? Also, is there any workaround i can do as of now?
If you pass an ad tag that has cue points at those time offsets, prefetching will happen automatically, except for the preroll which you can prefetch via ImaAdsLoader.requestAds
as described above.
I got the impression that you didn't have an ad tag with those cue points though, but instead you want to specify the cue points at runtime. The only way you can do that at the moment is to generate your own VMAP ad tag (which is probably quite a lot of work) and pass it to the ImaAdsLoader
. For example, you could produce an XML template with placeholders for the cue points, fill those in then pass it as a string ads response (not a URI).
(I apologise for barging into this post, clearly OP had a different issue, but there was an open question to me, so I'll answer) @andrewlewis Regarding:
I'm curious what you mean by implementing your own cue points -- do you know of an API for doing this that we are not currently using? Or are you building a custom ads response and passing that to the extension? Or something else? Thanks.
Nothing that fancy, sorry for not being clear. I just meant we don't use exoplayer-ui
library in our implementation.
Thank you for the info on timeline changed, also about requestAds
- both tips were helpful. It didn't occur to me to check the implementation in exoplayer-ui, where I would have found the answer I needed.
@zilinx Thanks for the information.
@Manvendra-Jadon Does my previous comment address your questions?
@andrewlewis Thanks for all the information. I plan to do it manually on my end. So this is not possible using SDK. We can close this issue.
Thanks. Leaving this open as a low priority enhancement to track investigating using manual ad breaks.
I found this already logged issue: https://github.com/google/ExoPlayer/issues/4232 But this was logged in 2018. I want to know, if it is possible to add the same now.
for e.g. custom cue points like00:05:22.00,00:10:20.00,00:14:50.00
Doing and managing it manually on our end would be a big issue and buggy.
Google IMA SDK for iOS provides this way of adding cue points. Can we make it possible on exoplayer-ima-extension if not already feasible?