support Contact Support | system status System Status
Page Contents

    Error Handling with the Native SDK for iOS

    In this topic, you will learn how the Brightcove Native SDK for iOS handles playback errors.

    Overview

    Error codes have the term ErrorCode in the name. For example:

    kBCOVPlaybackSessionErrorCodeLoadFailed

    Events have the word Event in the name. For example:

    kBCOVPlaybackSessionLifecycleEventFail

    Playback errors

    Playback errors are handled through events. Generally speaking you would receive playback errors using the lifecycle event delegate callback on the BCOVPlaybackController:

    - (void)playbackSession:(id<BCOVPlaybackSession>)session
      didReceiveLifecycleEvent:(BCOVPlaybackSessionLifecycleEvent *)lifecycleEvent

    To get further information, do the following:

    1. If you get an error event like kBCOVPlaybackSessionLifecycleEventFail or kBCOVPlaybackSessionLifecycleEventResumeFail, check the event's properties dictionary for an @"error" key.

      This will provide an NSError object with information about the problem.

    2. Each NSError will have an error domain, like the following:

      • NSCocoaErrorDomain
      • kBCOVPlaybackSessionErrorDomain
       

      Each error domain will have an associated error code and error description, like the following:

      • kBCOVPlaybackSessionErrorCodeLoadFailed
      • kBCOVPlaybackSessionErrorCodeNoPlayableSource
    3. Some errors will also have an underlying error that can be retrieved from the error object's userInfo dictionary with the NSUnderlyingErrorKey key. This will typically be a system NSError that can provide more information.

    4. To find all the error domains in the SDK, search the headers for the following:

      ErrorDomain

      Here is a list of headers that have ErrorDomain references:

      • BCOVFPSAuthorizationProxy.h
      • BCOVFPSBrightcoveAuthProxy.h
      • BCOVOfflineVideoManager.h
      • BCOVOnceCommon.h
      • BCOVOnceONOXMLDocument.h
      • BCOVOUXConstants.h
      • BCOVPlaybackService.h
      • BCOVPlaybackSession.h
    5. To find all the error codes, search each ErrorDomain for the following:

      ErrorCode

      For example, in BCOVPlaybackSession.h, you'll see kBCOVPlaybackSessionErrorDomain with the following error codes:

      • kBCOVPlaybackSessionErrorCodeLoadFailed
      • kBCOVPlaybackSessionErrorCodeFailedToPlayToEnd
      • kBCOVPlaybackSessionErrorCodeNoPlayableSource
    6. Other domains may return errors differently. For example, the BCOVPlaybackService object will return errors in its completion blocks if there are network errors when requesting videos from the online catalog. It uses the error domain kBCOVPlaybackServiceErrorDomain.


    Page last updated on 12 Jun 2020