Errors (iOS SDK)

The iOS SDK may return various errors. These can be caught via the createPlayer() method and DMPlayerDelegate's didFail delegate errors.

Error types

ErrorError description
PlayerError.underlyingRemoteError(error: Error)Triggered by the embed Player and forwarded by the SDK. Details about possible video access error is documented here.
PlayerError.advertisingModuleMissingTriggered by the SDK when the advertising module is missing. Please add it, otherwise the Player will not run
PlayerError.playerIdNotFoundTriggered by the SDK when the Player ID cannot be found
PlayerError.stateNotAvailableTriggered by the SDK when asking the Player for current state, but state is not available at that time
PlayerError.internetNotConnectedPlayer request failed since the internet seems offline - Retry the call
PlayerError.requestTimedOutPlayer request took longer than expected - Retry the call
PlayerError.otherPlayerRequestErrorOther Player request related error - Check the logs for more info
PlayerError.unexpectedTriggered when something went wrong and an unexpected error has occurred - Check the logs for more info - If it persists, contact support

Handling errors

PlayerError implements swift Error protocol and can be safely casted to NSError if needed.

Exemple:

func handlePlayerError(error: Error) {
    switch(error) {
    case PlayerError.advertisingModuleMissing :
      break;
    case PlayerError.stateNotAvailable :
      break;
    case PlayerError.underlyingRemoteError(error: let error):
      let error = error as NSError
      if let errDescription = error.userInfo[NSLocalizedDescriptionKey],
         let errCode = error.userInfo[NSLocalizedFailureReasonErrorKey],
         let recovery = error.userInfo[NSLocalizedRecoverySuggestionErrorKey] {
        print("Player Error : Description: \(errDescription), Code: \(errCode), Recovery : \(recovery) ")
        
      } else {
        print("Player Error : \(error)")
      }
      break
    case PlayerError.requestTimedOut:
      print(error.localizedDescription)
      break
    case PlayerError.unexpected:
      print(error.localizedDescription)
      break
    case PlayerError.internetNotConnected:
      print(error.localizedDescription)
      break
    case PlayerError.playerIdNotFound:
      print(error.localizedDescription)
      break
    case PlayerError.otherPlayerRequestError:
      print(error.localizedDescription)
      break
    default:
      print(error.localizedDescription)
      break
    }
  }