Error handling

The Flowplayer Android SDK provides a long list of callbacks for monitoring the player's state. Error callbacks are part of this list but in many cases they may require special handling.

There are errors that may not interrupt the content playback (eg. ad-related errors) but there are cases where the playback will be interrupted. In these cases, if you use the built-in controls, a meaningful message will be presented to the user together with a reload button. You can change these messages or provide translations to languages other than English by overriding the following string keys in your project's resources:

<!-- An error related to the playback has occurred. -->
<string name="flowplayer_error_playback">Failed to play media.</string>

<!-- The access token could not be validated and therefore the playback cannot start. -->
<string name="flowplayer_error_access_token">Failed to validate access token.</string>

<!-- Failed to load a Flowplayer config. -->
<string name="flowplayer_error_config">Failed to load media.</string>

<!-- Failed to load the built-in controls. This probably happened due to poor or no Internet connection. -->
<string name="flowplayer_error_controls">Failed to load built-in controls.</string>

<!-- This message will actually not be shown to the user since the playback will not be interrupted. The message will be included in the error callback though. -->
<string name="flowplayer_error_ad">Failed to load ad.</string>

<!-- This actually should not happen but it works as a fallback in case some other (really) unexpected error has occurred. -->
<string name="flowplayer_error_unspecified">An unknown error has occurred.</string>

Finally, if the playback has been interrupted, you may want to reload the player without having to call prepare() again. This can be conveniently achieved by calling: