Show Menu
TOPICS×

Set up error handling

You can set up one lace to handle errors.
  1. Implement an event callback function for MediaPlayerEvent.STATUS_CHANGED .
    TVSDK passes event information, such as a MediaPlayerStatusChangeEvent object.
  2. In the callback, when the returned status is MediaPlayerStatus.ERROR , provide logic to handle all errors.
  3. After the error is handled, reset the MediaPlayer object or load a new media resource.
    When the MediaPlayer object is in the error status it remains in that status until you reset it using the MediaPlayer.reset method.
For example:
mediaPlayer.addEventListener(MediaPlayerEvent.STATUS_CHANGED,  
  new StatusChangeEventListener() { 
    @Override 
    public void onStatusChanged(MediaPlayerStatusChangeEvent event) { 
        if (event.getStatus() == MediaPlayerStatus.ERROR) { 
        // handle TVSDK error here 
        } 
    } 
});