CISClientProtocol
@protocol CISClientProtocol <NSObject>
An instance of a client.
The class conforming to this protocol manages the SDK lifecycle and video sessions.
Generally, in an application, a single instance of class conforming to this protocol is required.
The class instance conforming to this protocol can be used to manage, create PlayerStateManager sessions and perform other important tasks.
-
Creates a Conviva monitoring session. Use when the viewer requests playback for video content. Unless your application can display multiple videos concurrently, you should only ever have one active monitoring session.
Declaration
Objective-C
- (int)createSessionWithMetadata:(CISContentMetadata *)cisContentMetadata;
Swift
func createSession(with cisContentMetadata: CISContentMetadata!) -> Int32
Parameters
cisContentMetadata
contentMetadata An instance of ContentMetadata containing the content metadata for this session.
Return Value
Opaque identifier for the newly created session. Will be NO_SESSION_KEY if session creation failed.
-
Creates a Conviva Ad monitoring session. Use when an ad playback starts for a particular content session. Unless your application can display multiple videos concurrently, you should only ever have one active monitoring session.
Declaration
Objective-C
- (int)createAdSession:(int)contentSessionKey adMetadata:(CISContentMetadata *)adMetadata;
Swift
func createAdSession(_ contentSessionKey: Int32, adMetadata: CISContentMetadata!) -> Int32
Parameters
contentSessionKey
The identifier for the monitoring session in which advertisement playback is requested
adMetadata
An instance of CISContentMetadata containing the ad metadata for this session.
Return Value
Opaque identifier for the newly created ad session. Will be NO_SESSION_KEY if session creation failed.
-
Terminates a monitoring session. Use when playback for video content ends, fails or is cancelled by the viewer.
Declaration
Objective-C
- (void)cleanUp;
Swift
func cleanUp()
-
Provides a PlayerStateManager instance.
Declaration
Objective-C
- (id<CISPlayerStateManagerProtocol>)getPlayerStateManager;
Swift
func getPlayerStateManager() -> CISPlayerStateManagerProtocol!
Return Value
An instance of PlayerStateManager.
-
Attach a video player to the monitoring session. Use when a video player becomes relevant for the current session.
Declaration
Objective-C
- (void)attachPlayer:(int)sessionKey playerStateManager:(id<CISPlayerStateManagerProtocol>)playerStateManager;
Swift
func attachPlayer(_ sessionKey: Int32, playerStateManager: CISPlayerStateManagerProtocol!)
Parameters
sessionKey
The identifier for the monitoring session.
playerStateManager
An instance of PlayerStateManager currently gathering data from a video player.
-
Reports an error for this monitoring session.
Declaration
Objective-C
- (void)reportError:(int)sessionKey errorMessage:(NSString *)errorMessage errorSeverity:(ErrorSeverity)severity;
Swift
func reportError(_ sessionKey: Int32, errorMessage: String!, errorSeverity severity: ErrorSeverity)
Parameters
sessionKey
The identifier for the monitoring session.
errorMessage
The error message to be reported.
severity
The severity of the error.
-
Update missing content metadata for an existing monitoring session. Metadata that was previously set will not be updated. This method will not update streamUrl,defaultResource and cdnName,for mentioned attributes a seperate update api is provided.
Declaration
Objective-C
- (void)updateContentMetadata:(int)sessionKey metadata:(CISContentMetadata *)contentMetadata;
Swift
func updateContentMetadata(_ sessionKey: Int32, metadata contentMetadata: CISContentMetadata!)
Parameters
sessionKey
The identifier for the monitoring session.
contentMetadata
New content metadata for the monitoring session.
-
Detach the video player from the monitoring session. Use when video player currently attached is no longer relevant for the current session.
Declaration
Objective-C
- (void)detachPlayer:(int)sessionKey;
Swift
func detachPlayer(_ sessionKey: Int32)
Parameters
sessionKey
The identifier for the monitoring session.
-
Notification that we will be preloading content with the video player. Use when a video player is loading content but is not yet displaying video for the viewer.
Declaration
Objective-C
- (void)contentPreload:(int)sessionKey;
Swift
func contentPreload(_ sessionKey: Int32)
Parameters
sessionKey
The identifier for the monitoring session.
-
Notification that the attached video player is no longer preloading, and has started displaying video for the viewer. Only usable if preceded by contentPreload.
Declaration
Objective-C
- (void)contentStart:(int)sessionKey;
Swift
func contentStart(_ sessionKey: Int32)
Parameters
sessionKey
The identifier for the monitoring session.
-
Send a custom event to Conviva.
Declaration
Objective-C
- (void)sendCustomEvent:(int)sessionKey eventname:(NSString *)eventName withAttributes:(NSDictionary *)attributes;
Swift
func sendCustomEvent(_ sessionKey: Int32, eventname eventName: String!, withAttributes attributes: [AnyHashable : Any]! = [:])
Parameters
sessionKey
The identifier for the monitoring session. Use NO_SESSION_KEY if you do not yet have a monitoring session.
eventName
Name of the custom event.
attributes
A dictionary of key-value pairs associated with the event.
-
Terminates a monitoring session. Use when playback for video content ends, fails or is cancelled by the viewer.
Declaration
Objective-C
- (void)cleanupSession:(int)sessionKey;
Swift
func cleanupSession(_ sessionKey: Int32)
Parameters
sessionKey
The identifier for the monitoring session.
-
Properly frees a PlayerStateManager instance.
Declaration
Objective-C
- (void)releasePlayerStateManager: (id<CISPlayerStateManagerProtocol>)playerStateManager;
Swift
func releasePlayerStateManager(_ playerStateManager: CISPlayerStateManagerProtocol!)
Parameters
playerStateManager
An instance of PlayerStateManager to be free up.
-
Notify Conviva that an ad is about to start for the monitoring session.
Declaration
Objective-C
- (void)adStart:(int)sessionKey adStream:(AdStream)adStream adPlayer:(AdPlayer)adPlayer adPosition:(AdPosition)adPosition;
Swift
func adStart(_ sessionKey: Int32, adStream: AdStream, adPlayer: AdPlayer, adPosition: AdPosition)
Parameters
sessionKey
The identifier for the monitoring session.
adStream
Whether the ad is embedded in the content stream.
adPlayer
Whether the ad is played by the same player as the original video content.
adPosition
Whether the ad is a preroll, midroll or postroll.
-
Notify Conviva that an ad is about to start for the monitoring session.
Declaration
Objective-C
- (void)adStart:(int)sessionKey;
Swift
func adStart(_ sessionKey: Int32)
Parameters
sessionKey
The identifier for the monitoring session.
-
Notify Conviva that an ad has ended for the monitoring session.
Declaration
Objective-C
- (void)adEnd:(int)sessionKey;
Swift
func adEnd(_ sessionKey: Int32)
Parameters
sessionKey
The identifier for the monitoring session.
-
Return a PlayerStateManager instance.
Declaration
Objective-C
- (id<CISPlayerStateManagerProtocol>)getAttachedPlayer:(int)sessionKey;
Swift
func getAttachedPlayer(_ sessionKey: Int32) -> CISPlayerStateManagerProtocol!
Parameters
sessionKey
The identifier for the monitoring session.
-
Check if any PlayerStateManager is already attached to a session. Return true if a PlayerStateManager is currently attached to that session, false otherwise.
Declaration
Objective-C
- (BOOL)isPlayerAttached:(int)sessionKey;
Swift
func isPlayerAttached(_ sessionKey: Int32) -> Bool
Parameters
sessionKey
The identifier for the monitoring session.
-
Returns unique client id
Declaration
Objective-C
- (NSString *)getClientId;
Swift
func getClientId() -> String!