didStartPlayingClip
Notifies the SDK that the key play clip at the specified index started playing.
Overview
Call this method when your video player successfully starts playing a key play clip. This allows the SDK to update its UI to reflect the current playback state, such as highlighting the playing clip in the key plays list.
Syntax
abstract fun didStartPlayingClip(index: Int)
Parameters
| Parameter | Type | Description |
|---|---|---|
index | Int | The index of the clip that started playing |
Example
// When clip playback starts
fun onClipStarted(clipIndex: Int) {
viewModel.didStartPlayingClip(clipIndex)
}
// In a video player callback
videoPlayer.setOnPlaybackStartListener { clip ->
val index = getClipIndex(clip)
viewModel.didStartPlayingClip(index)
}
// With error handling
override fun playClip(index: Int, clipId: String?) {
lifecycleScope.launch {
try {
val clip = getClipAtIndex(index)
videoPlayer.play(clip)
// Notify SDK of successful start
viewModel.didStartPlayingClip(index)
} catch (e: Exception) {
// Notify SDK of failure
viewModel.clipDidFailToPlay(index)
}
}
}
Notes
- Call this method immediately after clip playback starts
- The index should match the index provided in
playClip() - The SDK will update UI to show the clip as currently playing
- Pair this with
didStopPlayingClip()when playback ends
Related Methods
- didStopPlayingClip() - Notify when clip stops playing
- clipDidFailToPlay() - Notify if clip fails to play
- playClip() - SDK requests clip playback