Player Errors - Straas/Straas-iOS-sdk GitHub Wiki

How to Receive Errors in STSSDKPlayerView

When you call loadVideo/loadLive/loadPlaylist in the Player module, you may encounter various errors, you can receive there by setting a delegate conforms to STSPlayerPlaybackEventDelegate and using the delegate function -(void)playerView:(STSSDKPlayerView *)playerView error:(NSError *)error; to retrieve NSError and STSPlayerErrorCode and reference the error code document.

Here are the error types:

The Errors that are Recommended to Reload Live Id

None. Because iOS SDK will try for the cases needed, the developers don't need to do extra tries.

  • [STSPlayerErrorCodeNetwork](https://straas.github.io/Straas-iOS-sdk/StraaSPlayerSDK/Enums/STSPlayerErrorCode.html#/c:@E@STSPlayerErrorCode@STSPlayerErrorCodeNetwork)
    • root cause: Network error, underlying error object is included in the user info dictionary.
    • e.g. the client's network is unstable or disconnected.
    • recommended solution: you can show UI when the network is disconnected to indicator the users.

The Errors that are not Need to Reload Live Id

  • STSPlayerErrorCodeSocketConnection
    • root cause: Failed to connect to the socket server(for listening live event) or disconnected from the socket server due to unexpected error after a connection was established successfully.
    • e.g. the client's network is unstable or disconnected.
    • recommended solution: the socket manager STSLiveEventListener will try on its own and may stop the STSSDKPlayerView after failures. You can show UI when the network is disconnected to indicator the users.
  • STSPlayerErrorCodeSDKInternal
    • root cause: SDK internal error happened, please try again or report issue. The response code (4XX) of the client's request is caused by unknown.
    • e.g. there is an unknown player error
    • recommended solution: record the reproduce steps and environment and report to iKala FAE.
  • STSPlayerErrorCodePlayer
    • root cause: Playback has been stopped due to error. Usually caused by player failing to play playerItem. PlayerItem may fail due to invalid url, bad network.
    • e.g. the bad network caused the client to receive m3u8 later than 3 seconds.
    • recommended solution: the player STSSDKPlayerView will try on its own and may stop after various failures. You can show UI if the network is disconnected to indicator the users. If it keep happens, please record the reproduce steps and environment and report to iKala FAE.
  • STSPlayerErrorCodeServer
    • root cause: Server side error happened, please try again later or contact with service provider.
    • e.g. unknown error from server/ the client SDK version is outdated.
    • recommended solution: you may need to update the client SDK version or contact iKala's FAE.
  • STSPlayerErrorCodeDataDeserialization
    • root cause: The format of the received data is unacceptable.
    • e.g. the Staas iOS SDK version is outdated.
    • recommended solution: you may need to update the client SDK version or contact iKala's FAE.
  • STSPlayerErrorCodeNotFound
    • root cause: The requested resource is not found.
    • e.g. input the wrong VOD/live id
    • recommended solution: confirm the VOD/live id.
  • STSPlayerErrorCodeMediaPermissionDenial
    • root cause: Current member has no permission to get the requested resource. This resource may need to be paid to get.
    • e.g. try to play the paid video with the member without permission
    • recommended solution: purchase the video with server CMS API first
  • STSPlayerErrorCodeTooManyRequest
    • root cause: Too many requests for the server, please try again later.
    • e.g. client hits the rate limit the server accepted
    • recommended solution: try later. Or do exponential back-off if needed.
  • STSPlayerErrorCodeSDKUnauthorized
    • root cause:
      • Have no permission to use the SDK. Make sure you've configured your app successfully.
      • Check if you've set the STSSDKClientID corresponding to your Bundle id in your project setting and have called STSApplication's configureApplication method to configure your identity.
      • REMIND: you need to register your bundle id to StraaS.io to get an client_id(STSSDKClientID).
    • e.g. the STSSDKClientID is empty in the build setting file
    • recommended solution: fill the correct STSSDKClientID
  • STSPlayerErrorCodeUnprocessableEntity
    • Unprocessable entity. May occurred due to unacceptable input value.
    • e.g. the member JWT is wrong
    • recommended solution: confirm the input value of the API call.
  • [STSPlayerErrorCodeOperationDenied](https://straas.github.io/Straas-iOS-sdk/StraaSPlayerSDK/Enums/STSPlayerErrorCode.html#/c:@E@STSPlayerErrorCode@STSPlayerErrorCodeOperationDenied)
    • root cause: Operation denied. May occur due to calling the method in a wrong state.
    • e.g. calling startWithLiveId when the state is not STSLiveEventListenerStateIdle.
    • recommended solution: confirm the sequence of API calling.
  • [STSPlayerErrorCodeInvalidLiveId](https://straas.github.io/Straas-iOS-sdk/StraaSPlayerSDK/Enums/STSPlayerErrorCode.html#/c:@E@STSPlayerErrorCode@STSPlayerErrorCodeInvalidLiveId)
    • root cause: Invalid live id. The live id should not be nil or empty string.
    • e.g. calling loadVideoWithId with an empty string.
    • recommended solution: confirm the live id and developement environment.
  • [STSPlayerErrorCodeCancelled](https://straas.github.io/Straas-iOS-sdk/StraaSPlayerSDK/Enums/STSPlayerErrorCode.html#/c:@E@STSPlayerErrorCode@STSPlayerErrorCodeCancelled)
    • root cause: The operation was cancelled before it was completed.
    • e.g. calling loadVideoWithId for twice immediately.
    • recommended solution: confirm if there's any cancelation action when calling APIs.
  • STSPlayerErrorCodeJWTTokenUnauthorized
    • root cause: Member JWT is invalid or expired. Please try again with a new member JWT.
    • e.g. input the empty or wrong member JWT.
    • recommended solution: input the correct member JWT.