Skip to main content

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​

fun didStartPlayingClip(index: Int)

Parameters​

ParameterTypeDescription
indexIntThe index of the clip that started playing

Example​

// When clip playback starts
fun onClipStarted(clipIndex: Int) {
sdk.didStartPlayingClip(clipIndex)
}

// In a video player callback
videoPlayer.setOnPlaybackStartListener { clip ->
val index = getClipIndex(clip)
sdk.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
sdk.didStartPlayingClip(index)
} catch (e: Exception) {
// Notify SDK of failure
sdk.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