google / ExoPlayer

An extensible media player for Android
Apache License 2.0
21.65k stars 6k forks source link

Allow discarding ad breaks #6405

Open raunakyadav opened 4 years ago

raunakyadav commented 4 years ago

[REQUIRED] Searched documentation and issues

Found it in a comment in medium post

[REQUIRED] Question

Is manual ad break supported by IMA extension? I am not receiving "AD_BREAK_READY" event if i make changes for it as mentioned here I have a use case where I want to select whether or not to play an ad basis some time calculations. For that, I need to listen to ad_break_ready event from IMA and play the ad only if condition is met.
Note that I have customised ImaAdsLoader class for these changes.

A full bug report captured from the device

N/A

Link to test content

Any test vmap ad tag would do.

andrewlewis commented 4 years ago

I'm afraid we don't support this. For VMAP we show ad break at the time given in the VMAP file and single VAST ads play as prerolls.

raunakyadav commented 4 years ago

Hi Andrew, Thanks for replying.

Our main requirement is to be able to skip loading few (pre/midroll) ads if time 'x' has not passed since the last ad played anywhere in the app. If I follow this comment, a. the ad is skipped but I can see load/play callbacks and some errors in IMA logs. b. Most of the times I do not get the "ALL_ADS_COMPLETED" callback. c. In case of postroll being skipped, I see the player showing the play state icon until the ad timeout log. d. I am worried it would mess up with the error tracking that we do for ads.

Logs: 2019-09-10 12:29:24.462 10906-10906/com.ry.exodemo D/ImaAdsLoader: Initialized with ads rendering settings: AdsRenderingSettings [bitrate=-1, mimeTypes=[video/mp4, video/webm, video/3gpp, audio/mp4, audio/mpeg], uiElements=null, enablePreloading=true, playAdsAfterTime=-1.0] 2019-09-10 12:29:24.810 10906-10906/com.ry.exodemo D/ImaAdsLoader: onAdEvent: LOADED 2019-09-10 12:29:24.822 10906-10906/com.ry.exodemo D/ImaAdsLoader: loadAd in ad group -1 2019-09-10 12:29:24.822 10906-10906/com.ry.exodemo W/ImaAdsLoader: Unexpected loadAd without LOADED event; assuming ad group index is actually 0 2019-09-10 12:29:24.823 10906-10906/com.ry.exodemo W/ImaAdsLoader: Unexpected loadAd in an ad group with no remaining unavailable ads 2019-09-10 12:29:24.829 10906-10906/com.ry.exodemo D/ImaAdsLoader: onAdEvent: CONTENT_PAUSE_REQUESTED 2019-09-10 12:29:24.862 10906-10906/com.ry.exodemo D/ImaAdsLoader: playAd 2019-09-10 12:29:32.830 10906-10906/com.ry.exodemo D/ImaAdsLoader: onAdEvent: LOG 2019-09-10 12:29:32.830 10906-10906/com.ry.exodemo I/ImaAdsLoader: AdEvent: {errorMessage=VAST media file loading reached a timeout of 8 seconds., errorCode=402, type=adPlayError} 2019-09-10 12:29:32.852 10906-10906/com.ry.exodemo D/ImaAdsLoader: onAdEvent: CONTENT_RESUME_REQUESTED 2019-09-10 12:29:32.852 10906-10906/com.ry.exodemo D/ImaAdsLoader: Unexpected CONTENT_RESUME_REQUESTED without stopAd 2019-09-10 12:29:32.872 10906-10906/com.ry.exodemo D/ImaAdsLoader: pauseAd 2019-09-10 12:29:36.969 10906-10906/com.ry.exodemo D/ImaAdsLoader: onAdEvent: LOADED 2019-09-10 12:29:36.969 10906-10906/com.ry.exodemo D/ImaAdsLoader: Loaded ad 1 of 1 in group 0 2019-09-10 12:29:36.969 10906-10906/com.ry.exodemo W/ImaAdsLoader: Unexpected ad count in LOADED, 1, expected 0 2019-09-10 12:29:36.989 10906-10906/com.ry.exodemo D/ImaAdsLoader: loadAd in ad group 0 2019-09-10 12:29:36.989 10906-10906/com.ry.exodemo W/ImaAdsLoader: Unexpected loadAd in an ad group with no remaining unavailable ads 2019-09-10 12:29:40.753 10906-10906/com.ry.exodemo D/ImaAdsLoader: onAdEvent: CONTENT_PAUSE_REQUESTED 2019-09-10 12:29:40.801 10906-10906/com.ry.exodemo D/ImaAdsLoader: playAd 2019-09-10 12:29:48.797 10906-10906/com.ry.exodemo D/ImaAdsLoader: onAdEvent: LOG 2019-09-10 12:29:48.797 10906-10906/com.ry.exodemo I/ImaAdsLoader: AdEvent: {errorMessage=VAST media file loading reached a timeout of 8 seconds., errorCode=402, type=adPlayError} 2019-09-10 12:29:48.829 10906-10906/com.ry.exodemo D/ImaAdsLoader: onAdEvent: CONTENT_RESUME_REQUESTED 2019-09-10 12:29:48.830 10906-10906/com.ry.exodemo D/ImaAdsLoader: Unexpected CONTENT_RESUME_REQUESTED without stopAd 2019-09-10 12:29:48.882 10906-10906/com.ry.exodemo D/ImaAdsLoader: pauseAd /////////////////////////////////

Just a side question, how big of a change would supporting manual ad break be if I want to implement that? It gives a better control over ads and looks like an important feature that is missing in IMA extension.

andrewlewis commented 4 years ago

This does indeed sound like it might be useful, but I don't think we will have time to look into it soon. You might want to experiment with calling AdsManager.discardAdBreak() but there is probably going to be some extra complexity in updating state in ImaAdsLoader when doing this (depending what callbacks IMA makes). I will mark this as a low-priority enhancement for now, to investigate whether we can expose that method and still use auto-playing ads.

LouisLin0706 commented 4 years ago

Hey guys Question here, this is ExoPlayer version 2.10.7 ImaAdsLoader Do we have any plan to handle else case inLOG event ?

螢幕快照 2019-11-26 下午4 13 15
andrewlewis commented 4 years ago

@LouisLin0706 Your question is not directly related to this issue (as far as I can tell), so I will mark it as off-topic. If you want to add your own ad event listener, please see #6316. If that is not sufficient for your use case, please file a separate issue.