Skip to main content
Every request and event carries where the viewer is in the episode, and overlay and pause ads follow the playback: an overlay shows over playing content only and goes away when the viewer pauses; a pause ad goes away when the content plays again after a pause seen while the ad is on screen, however the viewer resumed it. Give the SDK your player once the episode starts playing. With a Media3 player (ExoPlayer, MediaController), add so.kontext:video-media3 and hand it over; see Media3 player:
With a TTSDK player (TTVideoEngine), add so.kontext:video-ttsdk and hand over the engine the same way, ads.track(engine); see TTSDK player. With a Tencent Cloud Player SDK player (TXVodPlayer), add so.kontext:video-txplayer, call ads.track(player) and hand on your play events with KontextTXVodPlayer.onPlayEvent(player, event); see Tencent Cloud Player. With any other player, implement ContentPlayer: its position in milliseconds, and whether it plays. Buffering and seeking count as playing.
If your player has its own listeners, implement addListener and removeListener and call the ContentPlayer.Listener on each change (onIsPlayingChanged, onSeek, onContentChanged): an overlay then ends the moment the viewer pauses. Otherwise the SDK checks isPlaying four times a second while an overlay is on screen. The SDK holds the adapter until destroy() or the next track, so let the adapter hold your player weakly. If your player can tell which episode it plays, return it as currentItem (your item or its id; a new value for a loop’s next play). The SDK compares it with the value at track: once it differs, this episode’s overlay and pause ads throw Invalidated(ContentChanged) at show, and one on screen ends with INTERRUPTED. Call track when this episode starts playing, not when you create the VideoAds: until then the player’s time belongs to the previous episode. Before that the SDK sends 0, which is right for a prefetch.