For live/linear content, the PSDK replaces part of the stream by substituting a chunk of main content with an ad break of the same duration so that the timeline duration remains the same.
Before and during playback, the PSDK resolves known ads, replaces parts of the main content with ad breaks of equal duration at positions specified by cue points in the stream defined by the manifest, and recomputes the virtual timeline if needed.
For live and linear video streaming, the PSDK inserts ads as follows:
The PSDK accepts the ad break even if the duration is longer or shorter than the cue point replacement duration.
By default, the PSDK supports the following cue as a valid ad marker when resolving and placing ads:
#EXT-X-CUE DURATION=27 ID=identiferForThisCue ...
You can define and subscribe to additional cues (tags).
After playback starts, the video engine periodically refreshes the manifest file. The PSDK resolves any new ads and inserts them when a cue point is encountered in the live or linear stream defined in the manifest.
Each time after ads are resolved and inserted, the PSDK recomputes the virtual timeline and dispatches a MediaPlayer.PlaybackEventListener.onUpdated event to your application.