Set up error handling

Set up a single place 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 state is MediaPlayerState.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 state, it remains in that state until you reset it using the MediaPlayer.reset method.

For example:

mediaPlayer.addEventListener( 
  MediaPlayerEvent.STATUS_CHANGED, new StatusChangedEventListener() { 
    @Override 
    public void onStatusChanged(MediaPlayerStatusChangeEvent event) { 
        if (event.getStatus() == MediaPlayerStatus.ERROR) { 
            // handle TVSDK error here 
        } 
    } 
});

On this page

Adobe Summit Banner

A virtual event April 27-28.

Expand your skills and get inspired.

Register for free
Adobe Summit Banner

A virtual event April 27-28.

Expand your skills and get inspired.

Register for free
Adobe Maker Awards Banner

Time to shine!

Apply now for the 2021 Adobe Experience Maker Awards.

Apply now
Adobe Maker Awards Banner

Time to shine!

Apply now for the 2021 Adobe Experience Maker Awards.

Apply now