You can enable a TV-like experience of being able to join in the middle of an ad, in live streams. The Partial Ad break feature allows you to mimic a TV-like experience where, if the client starts a live stream inside a midroll, it will start within that midroll. It is similar to switching to a TV channel and the commercials run seamlessly.
For example, If a user joins in the middle of a 90-second ad break (three 30-second ads), 10 seconds into the second ad (that is, at 40 seconds into the ad break), the following happens:
This behavior is not enabled by default. To enable this feature work in your app, do the following:
Disable the live prerolls, using AdvertisingMetadata class’s method setEnableLivePreroll.
advertisingMetadata.setLivePreroll(false)
advertisingMetadata.setPreroll(false)
Switch ON the preference for Partial Ad-break Insertion. Use the new method setPartialAdBreakPref in MediaPlayer interface to switch this feature ON. Use getPartialAdBreakPref method to find the current state of this preference.
MediaPlayer mediaPlayer = new MediaPlayer(getActivity().getApplicationContext());
mediaPlayer.setPartialAdBreakPref(true);