Skip to content

Error handling

Every playback failure arrives as an OGPlayerError with a stable numeric code (the full table), a category, a human-readable message, and a retryable flag. Codes are identical on Android, iOS and web — one error strategy covers all your clients.

player.addListener(object : PlaybackListener {
override fun onError(error: OGPlayerError) {
crashlytics.log("playback ${error.code}: ${error.message}")
if (error.retryable) scheduleRetry()
}
})

The default error overlay ships with a Retry button. Tapping it calls player.retry(), which reloads the failed item — VOD resumes at the last healthy playback position (the SDK tracks it internally), live streams rejoin at the live edge. If the item carries ads the viewer already watched, they are not replayed (see the IMA guide).

Everything about it is configurable, on every platform:

  • Hide it: setShowRetryButton(false) (Android) · config.showRetryButton = false (iOS) · showRetryButton: false (web).
  • Relabel it, any language: setRetryButtonLabel("Probeer opnieuw") / config.retryButtonLabel / retryButtonLabel.
  • Remove it: setShowRetryButton(false) — the overlay shows only the message; recovery is your app’s call (player.retry() remains available from your own code, and resumes VOD at the last playback position).

The built-in overlay shows Playback error <code> by default. Map the codes to your own copy — any language, any tone — with errorMessageProvider in the UI config; returning nothing falls back to the default, and the raw error still reaches onError for logging:

OGUiConfig.Builder()
.setErrorMessageProvider { error -> strings.forPlaybackError(error.code) }
.build()

Good to know: the SDK recovers silently where it can (DRM retries on Android, live-edge retry before 6000 BEHIND_LIVE_WINDOW); ad errors are a separate, never-fatal channel (AdListener.onAdError); and buffering never masquerades as an error.