Conviva iOS SDK API Mapping for Migration from Conviva iOS SDK 2.x Version to Conviva iOS SDK 4.x Version

Maps the Conviva iOS SDK 2.x API methods to their 4.x equivalents to guide migration to the simplified 4.x sensor.

Updated 2026-05-29 ios, sdk, migration, sensor developer center, sensor integration

The Conviva SDK 4.x version is significantly simplified when compared to the Conviva SDK 2.x version. It reduces integration time and effort, and enables solid foundation for future Conviva Sensor implementation on Apple devices. Conviva strongly recommends migrating to Conviva SDK 4.x version. Only the Conviva SDK 4.x version will have new features implemented going forward.

The below table prescribes mapping of old 2.x API to the new 4.x API, as well as denotes the API methods that are not applicable anymore in Conviva SDK 4.x version. Full integration instructions can be found here.

**OLD (2.x)** **NEW (4.x)**
"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:

  1. The method which does 3 actions in one - create session, report error, cleanup session:
videoAnalytics.reportPlaybackFailed(errorMessage, contentInfo: contentInfo)
  1. 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:

  • Seek Start
playerStateManager.setPlayerSeekStart(pos);
  • Seek End
playerStateManager.setPlayerSeekEnd();

Seek Events:

  • Seek Start
videoAnalytics.reportPlaybackMetric(CIS_SSDK_PLAYBACK_METRIC_SEEK_STARTED, 
                                    value: NSNumber(value: 100))
  • Seek End
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:

  • Interface release - not needed anymore

  • videoAnalytics

videoAnalytics.cleanup();
  • SDK
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:

  • Ad Start
client.adStart(contentSessionKey, Client.AdStream.SEPARATE, 
Client.AdPlayer.SEPARATE, Client.AdPosition.PREROLL);
  • Ad End / Skipped
client.adEnd(contentSessionKey);

Handle Ads:

  • Ad Start
videoAnalytics.reportAdBreakStarted(AdPlayer.ADPLAYER_SEPARATE, 
adType: AdTechnology.CLIENT_SIDE, adBreakInfo: adAtrributes)
  • Ad End / Skipped
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)