| "Client" |
"Analytics" |
|
Initialize:
let clientSettings: CISClientSettingProtocol = try
CISClientSettingCreator.create(withCustomerKey: TEST_CUSTOMER_KEY)
clientSettings.setGatewayUrl(TOUCHSTONE_SERVICE_URL)
client = try
CISClientCreator.create(withClientSettings: clientSettings,
factory: systemFactory)
|
Initialize:
let analytics =
CISAnalyticsCreator.create(withCustomerKey: TEST_CUSTOMER_KEY,
settings: [CIS_SSDK_SETTINGS_GATEWAY_URL: Touchstone Service URL,
CIS_SSDK_SETTINGS_LOG_LEVEL: LogLevel.LOGLEVEL_WARNING.rawValue])!
// Note that the most important parameter – CUSTOMER_KEY –
//now becomes separate argument, not part of 'settings'
|
let setting : CISSystemSettings = CISSystemSettings()
setting.logLevel = LogLevel.LOGLEVEL_NONE
let clientSetting : CISClientSettingProtocol = try
CISClientSettingCreator.createWithCustomerKey(Customerkey)
clientSetting.setGatewayUrl(gatewayUrl)
|
Not needed. The settings are defined as an object which can
take values of pre-defined constants as keys:
settings: [CIS_SSDK_SETTINGS_GATEWAY_URL: Touchstone Service URL,
CIS_SSDK_SETTINGS_LOG_LEVEL: LogLevel.LOGLEVEL_WARNING.rawValue]
|
let systemInterFactory : CISSystemInterfaceProtocol =
IOSSystemInterfaceFactory.initalizeWithSystemInterface()
|
Not needed. |
PlayerStateManager
|
CISVideoAnalytics object for main video content and CISAdAnalytics object for advertisement content. |
client.getPlayerStateManager()
|
Instantiate videoAnalytics Object:
let videoAnalytics = analytics.createVideoAnalytics()
let convivaAdAnalytics =
analytics.createAdAnalytics(withVideoAnalytics: videoAnalytics);
|
playerStateManager.setCISIClientMeasureInterface!(xyzPlayerInterface)
|
Implement a callback function and pass the callback function to setUpdateHandler() method.
In the callback function, report values for the individual metrics using generic videoAnalytics.reportPlaybackMetric() API.
Example:
func setUpdateHandler(updateHandler :UpdateHandler);
// Sample code snippet
videoAnalytics.setUpdateHandler {
videoAnalytics.reportPlaybackMetric(CIS_SSDK_PLAYBACK_METRIC_BUFFER_LENGTH,
value: NSNumber(value: 30000))
videoAnalytics.reportPlaybackMetric(CIS_SSDK_PLAYBACK_METRIC_PLAY_HEAD_TIME,
value: NSNumber(value: 10000))
videoAnalytics.reportPlaybackMetric(CIS_SSDK_PLAYBACK_METRIC_RENDERED_FRAMERATE,
value: NSNumber(value: 20))
}
|
client.attachPlayer()
|
setPlayer
Not needed. Report metrics directly to videoAnalytics. In case of "module" integration, for example, AVPlayer module, use videoAnalytisc.setPlayer(/* AVPlayer Object */ player);.
|
|
Session Creation:
client.createSession(CISContentMetadata)
|
Session Creation:
videoAnalytics.reportPlaybackRequested(ContentInfo)
|
|
Reporting Metadata:
var contentMetadata: CISContentMetadata !
func createMetadataObject() -> CISContentMetadata {
contentMetadata = CISContentMetadata()
contentMetadata.assetName = "Test Video"
contentMetadata.streamUrl = "streamUrl"
}
|
Reporting Metadata:
var contentInfo = [String: Any]()
contentInfo[CIS_SSDK_METADATA_ASSET_NAME] = "ASSET_NAME"
contentInfo[CIS_SSDK_METADATA_PLAYER_NAME] = "APPLICATION_NAME"
videoAnalytics.setContentInfo(contentInfo)
|
|
Report Error:
client.reportError()
|
Report Error:
- The method which does 3 actions in one - create session, report error, cleanup session:
videoAnalytics.reportPlaybackFailed(errorMessage, contentInfo: contentInfo)
- The method which reports an error and creates a session if
reportPlaybackRequested() is not called before:
videoAnalytics.reportPlaybackError(message, severity);
If you have retry logic, then use the second method.
|
playerStateManager.setPlayerState()
|
Player state:
videoAnalytics.reportPlaybackMetric(metric_key, metric_value)
For player state, use the following parameters:
metric_key - CIS_SSDK_PLAYBACK_METRIC_PLAYER_STATE
metric_value - PlayerState.CONVIVA_PAUSED.rawValue
|
|
Video Resolution:
playerStateManager.setVideoResolutionWidth(w)
playerStateManager.setVideoResolutionHeight(h)
|
Video Resolution:
videoAnalytics.reportPlaybackMetric(CIS_SSDK_PLAYBACK_METRIC_RESOLUTION,
value: NSValue(cgSize: CGSize(width: 1280, height: 720)));
|
|
Seek Events:
playerStateManager.setPlayerSeekStart(pos);
playerStateManager.setPlayerSeekEnd();
|
Seek Events:
videoAnalytics.reportPlaybackMetric(CIS_SSDK_PLAYBACK_METRIC_SEEK_STARTED,
value: NSNumber(value: 100))
videoAnalytics.reportPlaybackMetric(CIS_SSDK_PLAYBACK_METRIC_SEEK_ENDED,
value: NSNumber(value: 1000))
|
|
Bitrate:
playerStateManager.setBitrateKbps(currentRenderingBitrateKbps);
|
//Value should be integer
videoAnalytics.reportPlaybackMetric(CIS_SSDK_PLAYBACK_METRIC_BITRATE,
value: currentRenderingBitrateKbps)
|
|
Background:
Clean up session when the application is backgrounded.
|
Background:
[analytics reportAppBackgrounded];
|
|
Foreground:
Re-create a new session when the application is foregrounded.
|
Foreground:
[analytics reportAppForegrounded];
|
|
Update Metadata:
client.updateContentMetadata(videoSessionID, metadata: contentMetaData)
|
Update Metadata:
videoAnalytics.setContentInfo(contentInfo)
|
|
On events such as bumper video or pop up requiring user wait, the solution was to call:
- Bumper video start or pop up displayed.
client.adStart()
- Bumper video end or pop up dismissed.
client.adEnd()
|
We introduced dedicated API calls for these use cases.
- Bumper video start or pop up displayed
videoAnalytics.reportPlaybackEvent(CISConstants.getEventsStringValue(
Events.USER_WAIT_STARTED), withAttributes: nil)
- Bumper video end or pop up dismissed
videoAnalytics.reportPlaybackEvent(CISConstants.getEventsStringValue(
Events.USER_WAIT_ENDED), withAttributes: nil)
|
|
Session Clean up:
client.cleanupSession(contentSessionKey);
|
Session Clean up:
videoAnalytics.reportPlaybackEnded();
|
|
Player interface clean up and client release:
mPlayerInterface.cleanup();
client.releasePlayerStateManager(playerStateManager);
client.release();
|
Player interface clean up and client release:
videoAnalytics.cleanup();
analytics.cleanup();
|
|
Player Framework and Version:
playerStateManager
.setPlayerType("FRAMEWORK_NAME");
//SET PLAYER FRAMEWORK VERSION
playerStateManager.setPlayerVersion("1.2.3.4");
|
Player Framework and Version:
var playerInfo = [String: Any]()
playerInfo[CIS_SSDK_PLAYER_FRAMEWORK_NAME] = "PLAYER_NAME"
playerInfo[CIS_SSDK_PLAYER_FRAMEWORK_VERSION] = "1.2.3.4"
videoAnalytics.setPlayerInfo(playerInfo)
|
|
Handle Ads:
client.adStart(contentSessionKey, Client.AdStream.SEPARATE,
Client.AdPlayer.SEPARATE, Client.AdPosition.PREROLL);
client.adEnd(contentSessionKey);
|
Handle Ads:
videoAnalytics.reportAdBreakStarted(AdPlayer.ADPLAYER_SEPARATE,
adType: AdTechnology.CLIENT_SIDE, adBreakInfo: adAtrributes)
videoAnalytics.reportAdBreakEnded()
|
|
"Pod" Events:
String eventName = "Conviva.PodStart";
client.sendCustomEvent(contentSessionKey, eventName, attributes);
|
No need to explicitly send Pod Events. It is covered by reportAdBreakStarted() or reportAdBreakEnded() API calls. |
|
Custom Events:
client.sendCustomEvent ( Conviva.Client.NO_SESSION_KEY, "share-click",
{"location": "Toolbar", "assetName": "Sample Video",
"shareService": "Facebook"});
|
Custom Events:
// New code uses ConvivaAnalytics to send the event
let eventType = "share-click"
var attr = [String: Any]()
attr["Toolbar"] = "location"
attr["Facebook"] = "shareService"
analytics.reportAppEvent(eventType, details: attr)
|