Show Menu
TOPICS×

Set up error handling

You can set up one place in your application to perform error handling in response to the ERROR state.
  1. Add an event listener for AdobePSDK.MediaPlayerStatusChangeEvent .
    For example:
    player.addEventListener(AdobePSDK.PSDKEventType.STATUS_CHANGED, 
                            onStatusChange);
    
    
  2. In your event listener, when the event.status is AdobePSDK.MediaPlayerStatus.ERROR , provide the 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 cannot exit this state until you complete one of the following tasks:
    
    
    • Reset the MediaPlayer object by using the MediaPlayer.reset method.
    • Load a new media resource by using the MediaPlayer.replaceCurrentResource method.
For example:
player.addEventListener(AdobePSDK.PSDKEventType.STATUS_CHANGED, onStatusChange); 
onStatusChange = function (event) { 
    switch (event.status) { 
        case AdobePSDK.MediaPlayerStatus.ERROR: 
            //handle error 
            break; 
    } 
}