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:
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().
Common error scenarios
- Empty or invalid playback ID: The SDK can’t resolve the stream URL.
- Invalid stream type:
streamTypemust beon-demandorlive-stream. - 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
onBufferingStartandonBufferingEndcallbacks to show appropriate UI. - Unsupported format: The stream uses a format or codec not supported by the device.
Frequently asked questions
How do I handle playback errors in the FastPix Android player?
Attach a PlaybackListener and implement onError(error: PlaybackException). It fires whenever a playback or validation error occurs, and error.message describes what went wrong.
How do I know if setFastPixMediaItem failed?
setFastPixMediaItem returns false when validation fails, for example an empty playbackId. The error details also arrive through the PlaybackListener.onError() callback, so listen there as well.
What are common causes of playback errors?
Common causes are an empty or invalid playback ID, an invalid stream type, an expired or invalid playback token, network issues, and a format or codec the device does not support.
How do I handle network buffering issues?
Use the onBufferingStart and onBufferingEnd callbacks to show and hide a loading spinner while an unstable connection buffers, rather than treating every stall as a hard error.
What’s next
- Listen to playback events for buffering, seek, and completion callbacks.
- Play uploaded videos to set a media item with
setFastPixMediaItem. - Enable secure video playback to avoid token errors on protected streams.