Handle playback errors

Learn how to detect and respond to playback errors in the FastPix Android Player.

Listen for errors

The PlaybackListener interface includes an onError callback that fires when a playback or validation error occurs. Attach the listener to your player to capture errors:

1val listener = object : PlaybackListener {
2 override fun onError(error: PlaybackException) {
3 // Handle the error
4 Log.e("Player", "Playback error: ${error.message}")
5 }
6
7 override fun onPlay() {}
8 override fun onPause() {}
9 override fun onPlaybackStateChanged(isPlaying: Boolean) {}
10}
11player?.addPlaybackListener(listener)

Validation errors

When you call setFastPixMediaItem, the SDK validates the configuration before starting playback. If validation fails (for example, an empty playbackId), the method returns false and the error details arrive through PlaybackListener.onError().

1val ok = player?.setFastPixMediaItem {
2 playbackId = "YOUR_PLAYBACK_ID"
3} ?: false
4
5if (!ok) {
6 // Validation failed — error details arrive via onError callback
7}

Common error scenarios

  • Empty or invalid playback ID: The SDK can’t resolve the stream URL.
  • Expired or invalid playback token: Secure streams reject the request if the token has expired or is malformed.
  • Network issues: Unstable connections cause buffering or playback failures. Use onBufferingStart and onBufferingEnd callbacks to show appropriate UI.
  • Unsupported format: The stream uses a format or codec not supported by the device.