AVPlayer, hand it over; the SDK reads its time and watches its playback (see AVPlayer):
TTVideoEngine), add the KontextVideoTTSDK product of the same package and hand over the engine, ads.track(ttVideoEngine: engine) { episode.id }; see TTSDK player.
With any other player, conform it to VideoAdsPlayer: its position in seconds, and whether it plays. Buffering and seeking count as playing.
isPlayingPublisher and an overlay ends the moment the viewer pauses; otherwise the SDK checks isPlaying four times a second while an overlay is on screen. The SDK keeps your VideoAdsPlayer until destroy() or the next track(_:), so a small wrapper needs no other reference; an AVPlayer is held weakly, as your app owns it. A wrapper that references the VideoAds (or the object owning it) keeps both alive until destroy(): call destroy() when the viewer leaves, or do not reference the ads from it.
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.