SmartLib

@interface SmartLib : NSObject

SmartLib library

  • Init SmartLib for all use cases Core, async nanoCDN resolution, register to app and system events

    Note: To be called once when the app starts

    Declaration

    Objective-C

    + (void)initSmartLib:(NSString *)analyticsAddress
                 nanoCDNHost:(NSString *)nanoCDNHost
        broadpeakDomainNames:(NSString *)broadpeakDomainNames;

    Parameters

    analyticsAddress

    Address of the analytics server (i.e. “http://server-host:8080”) or a analytics server list (i.e. “http://server-host:8080,https://server-host-2,http://server-host-3”)

    nanoCDNHost

    A nanoCDN host configuration. null/empty string “” or “discover” to enable discovery on the local network or “127.0.0.1” to enable discovery on the local device or “*” to enable discovery on the local network and the local device or a nanoCDN host list (i.e “192.168.1.1,192.168.1.10”)

    broadpeakDomainNames

    The domain name list used to identify Broadpeak sessions (i.e “cdn.broadpeak.com,cdn2.broadpeak.com”) “*” specific value is used to declare that all sessions are using a Broadpeak CDN null/empty string “” is used to declare that all given url are not hosted on a Broadpeak CDN

  • Init SmartLib for analytics only

    Note: To be called once when the app starts

    Declaration

    Objective-C

    + (void)initAnalytics:(NSString *)analyticsAddress;

    Parameters

    analyticsAddress

    Address of the analytics server (i.e. “http://server-host:8080”) or a analytics server list (i.e. “http://server-host:8080,https://server-host-2,http://server-host-3”)

  • getURL (session start, default method)

    Create a session on the Broadpeak CDN, create a session on the nanoCDN, identify if a non-Broadpeak CDN is used

    Workflow: getURL() -> session is running -> stopStreamingSession()

    Note: To be called to start any viewing session

    Declaration

    Objective-C

    + (NSString *)getURL:(NSString *)requestedURL;

    Parameters

    requestedURL

    Requested URL (i.e http://hostname/manifest)

    Return Value

    Stream URL if a session has been found or empty string “”

  • getQuery (session start, proxy mode, first call)

    Call this method just before creating your session, append the result to your requested URL

    Workflow: getQuery() -> handle session creation by your side -> startStreamingSession(…) -> session is running -> stopStreamingSession()

    Note: Not compatible in case of nanoCDN workflow, works with startStreamingSession

    Declaration

    Objective-C

    + (NSString *)getQuery;

    Return Value

    Query parameters to pass to the Broadpeak CDN through your proxy (i.e “bk-ml=1&smartlib-parameter=dev”)

  • startStreamingSession (session start, proxy mode, second call)

    Workflow: getQuery() -> handle session creation by your side -> startStreamingSession(…) -> session is running -> stopStreamingSession()

    Note: Only works if getQuery() has been called

    Declaration

    Objective-C

    + (void)startStreamingSession:(NSString *)contentURL
                    redirectedURL:(NSString *)redirectedURL;

    Parameters

    contentURL

    Content URL, url called by your side

    redirectedURL

    Stream URL, url retrieved by the proxy

  • Call this method after each session.

    Note: If the session ended on error, please use stopStreamingSession(statusCode)

    Declaration

    Objective-C

    + (id)stopStreamingSession;

    Return Value

    Session report

  • Call this method after each session.

    Declaration

    Objective-C

    + (id)stopStreamingSession:(BPStatusCode)statusCode;

    Parameters

    statusCode

    Optional parameter to specify session status code (i.e BPNetworkingError)

    Return Value

    Session report

  • Create a streaming session

    This object has to be stored by the app, it handles the session lifecycle (request to the CDN, mABR availability, error handling, generic event reporting, advanced parameters)

    Declaration

    Objective-C

    + (StreamingSession *)createStreamingSession;

    Return Value

    streaming session object

  • Create a streaming session with options

    This object has to be stored by the app, it handles the session lifecycle (request to the CDN, mABR availability, error handling, generic event reporting, advanced parameters)

    Declaration

    Objective-C

    + (StreamingSession *)createStreamingSession:(StreamingSessionOptions *)options;

    Parameters

    options

    An option map that specify all customized values for that session. If a parameter is not set, the global value is used.

    Return Value

    streaming session object

  • Create a streaming session

    This object has to be stored by the app, it handles the session lifecycle (player metrics, generic event reporting, custom parameters)

    Declaration

    Objective-C

    + (AnalyticsSession *)createAnalyticsSession;

    Return Value

    analytics session object

  • Create an analytics session with options

    This object has to be stored by the app, it handles the session lifecycle (player metrics, generic event reporting, custom parameters)

    Declaration

    Objective-C

    + (AnalyticsSession *)createAnalyticsSession:(StreamingSessionOptions *)options;

    Parameters

    options

    An option map that specify all customized values for that session. If a parameter is not set, the global value is used.

    Return Value

    analytics session object

  • Release sessions, nanoCDN resolution, unregister to app and system events

    Note: To be called once when the app is destroyed or when SmartLib will be not used for a while

    Note: SmartLib can be re-init if needed

    Declaration

    Objective-C

    + (void)release;
  • Deprecated

    Use [SmartLib getURL:contentURL] instead.

    DEPRECATED. Use [SmartLib getURL:contentURL] instead.

    Declaration

    Objective-C

    + (NSString *)getURLWithContentURL:(NSString *)contentURL;
  • Deprecated

    Use [SmartLib startStreamingSession:contentURL redirectedURL:redirectedURL] instead.

    DEPRECATED. Use [SmartLib startStreamingSession:contentURL redirectedURL:redirectedURL] instead.

    Declaration

    Objective-C

    + (void)startStreamingSessionWithContentURL:(NSString *)contentURL
                                    redirectURL:(NSString *)redirectedURL;
  • Attach a player to SmartLib to handle analytics

    To be called when the player instance is created

    Workflow: attachPlayer(…) -> getURL(…) -> session is playing -> stopStreamingSession() -> detachPlayer()

    Note: call before getURL

    Declaration

    Objective-C

    + (void)attachPlayer:(id)player;

    Parameters

    player

    Player instance

  • Attach a player to SmartLib to handle analytics

    To be called when the player instance is created

    Workflow: attachPlayer(…) -> getURL(…) -> session is playing -> stopStreamingSession() -> detachPlayer()

    Note: call before getURL

    Declaration

    Objective-C

    + (void)attachPlayer:(id)player listener:(id)listener;

    Parameters

    player

    Player instance

    listener

    Listener instance (depending on the player you use)

  • Detach the player from SmartLib

    To be called when the player instance is destroyed

    Workflow: attachPlayer(…) -> getURL(…) -> session is playing -> stopStreamingSession() -> detachPlayer()

    Note: call after stopStreamingSession

    Declaration

    Objective-C

    + (void)detachPlayer;
  • SmartLib initialized for all use cases (StreamingSession API)

    Declaration

    Objective-C

    + (BOOL)isInitialized;

    Return Value

    initialized for all use cases

  • SmartLib initialized for analytics only (AnalyticsSession API)

    Declaration

    Objective-C

    + (BOOL)isAnalyticsInitialized;

    Return Value

    initialized for analytics only

  • Undocumented

    Declaration

    Objective-C

    + (NSObject *)getListener;
  • Return the SmartLib version

    Declaration

    Objective-C

    + (NSString *)getVersion;

    Return Value

    SmartLib version

  • Allows SmartLib to have an unique identifier (account id, device id…)

    This uuid will be sent to the analytics server

    Declaration

    Objective-C

    + (void)setUUID:(NSString *)UUID;

    Parameters

    UUID

    uuid

  • Set the user agent used by SmartLib

    Declaration

    Objective-C

    + (void)setUserAgent:(NSString *)userAgent;

    Parameters

    userAgent

    User agent

  • Set the device type used by SmartLib

    Declaration

    Objective-C

    + (void)setDeviceType:(NSString *)deviceType;

    Parameters

    deviceType

    Device type

  • Set a custom parameter to be added to the session report

    Note: Only sent during non-Broadpeak sessions

    Declaration

    Objective-C

    + (void)setCustomParameter:(NSString *)name value:(NSString *)value;

    Parameters

    name

    Parameter name

    value

    Parameter value

  • Reset custom parameters

    Declaration

    Objective-C

    + (void)resetCustomParameters;
  • Force SmartLib to use a specific keepalive/teardown mechanism

    To be used in very specific cases (contact Broadpeak)

    Note: default value is FORCE_TEARDOWN_DEFAULT (use Broadpeak domain names)

    Declaration

    Objective-C

    + (void)setForceTeardown:(int)forceTeardown;

    Parameters

    forceTeardown

    FORCE_TEARDOWN_DISABLED, FORCE_TEARDOWN_DEFAULT, FORCE_TEARDOWN_ENABLED

  • Set the retry delay to resolve the nanoCDN

    Note: Only works with static nanoCDN hosts defined during init

    Declaration

    Objective-C

    + (void)setNanoCDNResolvingRetryDelay:(NSTimeInterval)delay;

    Parameters

    delay

    Delay between requests in secs

  • Listen to nanoCDN resolution events

    Declaration

    Objective-C

    + (void)registerNanoCDNReceiver:(id<NanoCDNReceiver>)receiver;

    Parameters

    receiver

    Receiver

  • Enable https nanoCDN resolution

    Enabled by default.

    Declaration

    Objective-C

    + (void)setNanoCDNHttpsEnabled:(BOOL)enabled;

    Parameters

    enabled

    enable https

  • Clear all resolved nanoCDN and restart resolving with all nanoCDN defined in nanoCDNHost init parameter

    Declaration

    Objective-C

    + (void)restartNanoCDNResolving;
  • Set an option at the global level.

    It replaces the default value and will be used for the next createStreamingSession. Options are reset to default values at SmartLib init.

    Declaration

    Objective-C

    + (void)setOption:(int)option valueWithBool:(BOOL)value;

    Parameters

    option

    The option to update. The list if available as static constants values in class StreamingSessionOptions.

    value

    Option value

  • Set an option at the global level.

    It replaces the default value and will be used for the next createStreamingSession. Options are reset to default values at SmartLib init.

    Declaration

    Objective-C

    + (void)setOption:(int)option valueWithInt:(int)value;

    Parameters

    option

    The option to update. The list if available as static constants values in class StreamingSessionOptions.

    value

    Option value

  • Set an option at the global level.

    It replaces the default value and will be used for the next createStreamingSession. Options are reset to default values at SmartLib init.

    Declaration

    Objective-C

    + (void)setOption:(int)option valueWithString:(NSString *)value;

    Parameters

    option

    The option to update. The list if available as static constants values in class StreamingSessionOptions.

    value

    Option value

  • Get the current session report

    Note: null if no session is running, use stopStreamingSession to get the session report at the end of a session

    Declaration

    Objective-C

    + (id)getSessionReport;

    Return Value

    Session report

  • Undocumented

    Declaration

    Objective-C

    + (NanoCDNHostManager *)getNanoCDNHostManager;
  • Undocumented

    Declaration

    Objective-C

    + (BpkRequestManager *)getRequestManager;