> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kontext.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Your player

> Give the SDK your content player: built-in support for some players, and VideoAdsPlayer for any other.

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](https://docs.kontext.so/video/sdk/kotlin/media3.md):

```kotlin theme={null}
import so.kontext.video.media3.track

ads.track(exoPlayer)
```

With a TTSDK player (`TTVideoEngine`), add `so.kontext:video-ttsdk` and hand over the engine the same way, `ads.track(engine)`; see [TTSDK player](https://docs.kontext.so/video/sdk/kotlin/ttsdk.md).

With any other player, implement `VideoAdsPlayer`: its position in milliseconds, and whether it plays. Buffering and seeking count as playing.

```kotlin theme={null}
class MyPlayerAdapter(player: MyPlayer) : VideoAdsPlayer {
    private val player = WeakReference(player)
    override val currentPositionMillis: Long get() = player.get()?.positionMillis ?: 0
    override val isPlaying: Boolean get() = player.get()?.let { it.state == State.PLAYING || it.state == State.BUFFERING } ?: false
}

ads.track(MyPlayerAdapter(myPlayer))
```

If your player has its own listeners, implement `addListener` and `removeListener` and call the `VideoAdsPlayer.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.

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.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.