Conviva DPI Sensor Integration
Conviva DPI Sensor Installation and Integration
Low-code integration of Conviva DPI sensor enables automatic, and semantic-less data collection. For more details to help get started with DPI integration, see DPI Integration FAQs.
Add Conviva library and headers |
Download the C SDK library: C SDK downloads page. Include the following header required for integration:
|
|---|
Initialize Conviva C-SDK Client
To initialize the Conviva C Client, refer to the 1. Install Conviva Library section of Conviva DPI Sensor Integration.
Start DPI Reporting
To start the ConvivaDPI tracker, call the start tracker API:
app_name- application name; mandatory inputuser_id- user identifier or name (if available at the time of starting the tracker)
snprintf(app_name, CCL_MAX_APP_NAME_LENGTH,"%s", "your_application_name_of_choice"); // mandatory field
snprintf(user_id, CCL_MAX_USER_ID_LENGTH,"%s", "logged_in_user_id_or_device_id");
cat_start_tracker(char* app_name, char* user_id);
Set User ID
Set the application user ID after initialization:
char *user_id;
user_id = strdup("Enter your UserID Here");
cat_set_user_id(user_id);
free(user_id);
Set Application Info
Set the application info after creating the tracker:
cat_app_info_t app_info;
// Set the optional parameters based on availability
app_info.app_load_start = 1752035360399; // Application Load Start time in seconds
app_info.app_load_end = 1752035360401; // Application Load End time in seconds
//Set the mandatory parameters after the tracker creation
sprintf(app_info.app_build, "%s", “1.2.0.1”);
sprintf(app_info.app_version, "%s", “v2.0”);
cat_set_application_info(&app_info);
Manage Custom Tags
Manage custom tags by using the following APIs:
cat_set_custom_tags()cat_clear_custom_tags()cat_clear_all_custom_tags()
// Set custom tags
ccl_dictionary_t *app_tags = ccl_dictionary_create();
ccl_dictionary_put (app_tags, “key1”, “value1”);
ccl_dictionary_put (app_tags, “key2”, “value2”);
cat_set_custom_tags(app_tags);
//Clear specific custom tags with keys
char *str = strdup("key1");
//clear the custom tag with key as “key1”
cat_clear_custom_tags(&str, 1); // list of keys and number of keys
//Clear all custom tags
cat_clear_all_custom_tags();
Report Application Install Event
Reports the app install event, only for the fresh installation of the app.
cat_track_app_install();
Report Custom Events
Track custom App events specific to your applications by calling the cat_send_custom_event API when DPI is enabled:
ccl_dictionary_put (dic, "key1", "value1");
ccl_dictionary_put (dic, "key2", "value2");
cat_send_custom_event ("CustomEvent1", dic);
ccl_dictionary_destroy (dic);
Report Screen View
This C-SDK library allows you to track screen view events of your applications by calling the cat_track_screen_view API, when DPI is enabled:
cat_screen_info_t screen;
memset(&screen, 0, sizeof(cat_screen_info_t));
screen.screen_name =strdup(“some name”);
screen.screen_type = strdup(“some_type”);
screen.load_start = 1752035360399;
screen.load_end = 1752035360401;
cat_track_screen_view (&screen);
This API shows screen_info, which includes one mandatory argument that tells the screen name/title and few optional arguments. This API tracks the time taken to load each screens by providing the start and end times in milliseconds (ms).
Report Network Request
This C-SDK library allows you to track the network events of your applications by calling the cat_track_network_request API, when DPI is enabled:
cat_network_request_info_t nw_info;
memset(&nw_info, 0, sizeof(cat_network_request_info_t));
// target url – mandatory input
strcpy(nw_info.target_url, "test_url_1.com");
// method – mandatory input
strcpy(nw_info.method, "post");
// timestamps -> mandatory inputs, with valid timestamps in milliseconds
nw_info.request_timestamp = 1729745074745;
nw_info.response_timestamp = 1729745074760;
// response status code – 0 will takes place if no valid value is set.
nw_info.response_code = 200;
cat_track_network_request(&nw_info);
Pause and Resume Tracker
This C-SDK library allows you to pause and resume the tracking of all events by calling the cat_pause_tracker and cat_resume_tracker APIs.
// pause the tracker when needed.
cat_pause_tracker();
// resume the tracker when needed.
cat_resume_tracker();
Report ANR Start Events
Use the cat_track_anr API to tracks of Application Not Responding (ANR) events. The API reports all unrecovered ANRs, including relevant details such as start_time and reason:
cat_anr_info_t anr_info;
memset(&anr_info, 0, sizeof(cat_anr_info_t));
// Mandatory parameter
anr_info.anr_start = 1752035360401;
// Optional
anr_info.anr_reason = strdup("reason for ANR");
cat_track_anr(&anr_info);
Report Application Error Events
Use the cat_track_application_error API to track application error events, with variety of information, and uses error_message and error_language are mandatory fields.
cat_app_error_info_t app_error;
memset(&app_error,0, sizeof(cat_app_error_info_t));
app_error.error_lang = CAT_ERROR_LANG_C;
app_error.error_msg = strdup(“Error inside carousel access”);
cat_track_application_error(&app_error);
Stop DPI Reporting
Use the following API to cleanup and stop the DPI tracker.
cat_stop_tracker();
Download C SDK for DPI sensor Integration.
Conviva Video Sensor Integration
Follow these instructions to complete the Conviva VSI Sensor integration on C players.
Step 1: Install Conviva Library
Developer Steps
Step 2: Configure Metadata
Developers Steps
Step 3: Report Events and Metadata
Developer Steps
Step 4: Handle User ActionsUse Conviva methods to handle user actions, such as backgrounding and foregrounding. Use Conviva methods to report custom events. Use Conviva methods to control data collection and delete collected data. Developer Steps
Step 5: Clean Up Session
Developer Steps
|
Prerequisites
Obtain your account's CUSTOMER_KEYs.**Conviva provides a test account and a production account for Test and Production environments, respectively. You can find your CUSTOMER_KEY here: Pulse - Account Info. Ask your Conviva representative for assistance if you have problems accessing it.
Pass the gatewayUrl parameter to init() method of Conviva SDK. The gatewayUrl is specific for your account and shall ONLY be used for tests, never for production deployment.
Sample gatewayUrl for Testing:
https://<*customer_key*>.ts-testonly.conviva.com
IMPORTANT: If there's any doubt on how to set the gateway URL, consult your Conviva representative - this is a critical parameter. For production, Conviva library uses the automatically-assigned gatewayUrl.
Use Touchstone 2.0 in Pulse to perform self-validation and debugging of video sensor integration
For Conviva JavaScript Sensor Integration, you can use any custom gateway URL with a proxy service setup. This is applicable for JavaScript version 4.7.13 onwards.
Plan your metadata
Conviva supports Pre-defined, Device, and Custom metadata. Work with your project team to determine the need to collect any custom metadata. It's also recommended to work with your Conviva representative to create your metadata plan prior to integration.
Integration Summary
Install the library and add dependencies.
Implement the platform interface.
Implement device metadata as part of the platform interface.
Initialize the library by calling
ccl_init(CUSTOMER_KEY, platform_interface, settings)using your CUSTOMER_KEY.
- Implement the metadata by following the instructions to use the pre-defined keys, as well as custom metadata, if applicable.
- Report ad break start / end.
- Implement ad metadata, events and metric reporting (if applicable).
- Start monitoring session by calling
ccl_session_create(content_info)method to report playback attempt request along with metadata (content, workflow, audience, and other relevant metadata). For the ads, start monitoring by callingccl_ad_session_create(video_session, ad_content_info)for each ad in the ad break. - Use the
ccl_session_destroy(session)method to report the of end playback. - Create an instance of
ccl_player_tas a callback container object to report video related events. - If your player has ads: create an instance of
ccl_player_tfor ads as a callback container object to report ad related events (if the ad player is different than video player). - Implement
start_monitoring()callback to retrieve theccl_notifier_tobject. Record the object for future use to report metrics. - Implement metric reporting via
ccl_player_tcallbacks andccl_notifier_tmethods for both video and ads (if applicable).
Handle user actions such as backgrounding, user dialogue, pin popup according to the specification.
Report network_metrics.
- Call
ccl_cleanup()to cleanup Conviva library and release memory / resources.
Test and Validate
After integration, perform a sanity check following the test cases in the Stream Sensor Sanity Test Plans spreadsheet. For the full validation test, use the test cases in the Stream Sensor Full Test Plans spreadsheet.
Use Touchstone in Pulse to perform self-validation and debugging of video sensor integration.
https://.ts-testonly.conviva.com
- Done! Analyse your data in Pulse and improve your viewer experience - let's make video experience better!
API Reference Documentation
The Conviva C SDK includes Reference Documentation for video and DPI sensor APIs.
Sample Application
The sample application illustrating Conviva integration example can be found along with the library, in the same .zip file. Please refer to the next step below for details.
1. Install Conviva Library
Add Conviva Library and Implement Platform Interface
Add Conviva library and headers |
Download the C SDK library: C SDK downloads page. Include the following header required for integration:
|
|---|---|
Initialize the Conviva C Client object |
settings: Custom settings for the library.
The allowed parameters are:
IMPORTANT: No need to set gateway_url and log_level settings for your production release explicitly. The Conviva sensor has the right default value.Sample code illustrating initialization with/without debug:
IMPORTANT:No need to set Expected Errors Due to Dual Stack IPv4/v6 Network SupportWhen the Conviva sensor is initialized with production settings, the SDK sends a single request to the endpoints below:
Sending both requests enables correlation of IPv4 and IPv6 addresses in dual-stack networks. If only IPv4 or IPv6 addressing is used (single-stack networking), it is expected that one request will fail. All the following requests will be sent to the endpoint below which supports both IPv4 and IPv6:
|
|
Implement Platform Interface |
The
Similarly, the methods
If mem_alloc() and mem_free() implementation is not required, then set it to "NULL".The A complete example that runs on Linux is included in the SDK. |
Implement Device Metadata |
While initializing C SDK through ccl_init(), C SDK will callback get_platform_metadata() API which is part of ccl_platform_t structure. Application shall provide all the platform metadata in ccl_platform_metadata_t structure when get_platform_metadata() API is called. The following is a code example that demonstrates the get_platform_metadata() callback implementation:
|
2. Configure Metadata
Metadata enables analysis of your data using different dimensions, for example, content, audience, device, workflow, player, and operating system.
Conviva categorizes metadata tags into three buckets (Predefined, Device, Custom).
Implement Video Metadata |
Implement pre-defined and custom tags for video by setting the properties of the Please refer to the below example illustrating pre-defined and custom metadata implementation for video:
|
|---|---|
Implement Ad Metadata |
Implement pre-defined and custom tags for ad content by setting the properties of the Please refer to the below example illustrating pre-defined and custom metadata for ads:
|
Pre-defined Metadata for Video and Ads
Conviva defines the constants or fixed string keys for commonly used metadata. These metadata keys provide critical information about video and ad content, versioning, workflow.
The below tags shall be added to both video and ad ccl_content_info_t objects:
Constants for Pre-defined Metadata for Video and Ads
| Key / Constant | Type | Video (ccl_session_create) | Ads (ccl_ad_session_create) |
|---|---|---|---|
| ccl_content_info_t.asset_name | char* | Report as unique name for each stream/video asset. Values are up to your choice, but a human-readable text prefixed with the unique video ID works best in most Conviva sensors.This provides for clarity in reports and makes most popular content easily identifiable.Pattern: [videoID] Video Title
The following are typical patterns for VOD (movies and episodic content) and Live streams:
|
Report as "ad title" or "[ad_id] ad_title". |
| ccl_content_info_t.is_live | int [0/1] | Denotes whether the content is video on-demand or a live stream. Affects the computation and availability of the Conviva metrics. | For Ads, the value shall be the same as for the video stream. |
| ccl_content_info_t.player_name | char* | A string value used to distinguish video players (applications). Simple values that are unique across all of your integrated platforms work best here. If the same player used across multiple platforms, e.g Tizen, LG TV, WEB, give separate names for each application / platofrm: e.g "JS Tizen", "JS LGTV", "JS WEB". Do not include the build or version number in this property. The intention is to have a simple way of differentiating data from different players / platforms. | Automatically copied from the video session. |
| ccl_content_info_t.viewer_id | char* | Required for Viewers Module. A unique identifier to distinguish individual viewers or devices through Conviva's Viewers Module. The value shall be unique abstract user's identifier. If user is anonymous, do not set any value for this tag. | Automatically copied from the video session. |
| ccl_content_info_t.stream_url | char* |
The manifest URL of the video stream.
The Conviva backend config server attempts to map a portion of StreamURL into a CDN name. For example: In the URL The URL values reported in the streamURL are case insensitive. The streamURLs with either uppercase or lowercase are acceptable. |
The manifest URL of the ad stream. |
| ccl_content_info_t.default_resource | char* |
Video server resource the stream is played from. Set this field when the video server resource cannot be inferred from the STREAM_URL. For example, if the streamURL is The DEFAULT_Resource value is case sensitive. If the resource name is initially reported as AKAMAI (uppercase) and subsequently modified in the app to akamai (lowercase), it is necessary to inform Conviva about the change because both need to be mapped in the Conviva backend configuration server to ensure that both point to the same CDN name (AKAMAI). |
Ad server resource the stream is played from. Set this field when the video server resource cannot be inferred from the STREAM_URL. |
| ccl_content_info_t.duration | int | Duration of the video content, in seconds. | Duration of the single ad clip, in seconds. For example, in a block of 3 ads each 30 seconds long, report 30 sec for each corresponding ad. |
| "c3.app.version" | char* | Application build version. Shall have the same value for both ads and video. Set it by calling:
ccl_dictionary_put (video_content_info->tags, "c3.app.version", "1.0.123"); |
Application build version. Shall have the same value as for the video content. Set it by calling:
ccl_dictionary_put (ad_content_info->tags, "c3.app.version", "1.0.123"); |
IMPORTANT: To assign content category labels, such as Audio, Trailer, Tile Play, or Short Video, use the c3.cm.categoryType pre-defined content metadata constant.
Constants for Pre-defined Metadata for Video Only
These metadata tags shall be set via ccl_content_info_t* video_content_info->tags object for video session:
| Key | Type | Description |
|---|---|---|
| "c3.cm.contentType" | string | Advanced content delivery methods along with Live and VOD.
Acceptable values: "Live", "Live-Linear", "DVR", "Catchup", "VOD". |
| "c3.cm.channel" | string | The channel on which the content is consumed.
Example: "ABC". |
| "c3.cm.brand" | string | The name of the brand to which the content belongs.
Examples: "ABC X", "ABC Y". |
| "c3.cm.affiliate" | string | Affiliate or MVPD name for TV Everywhere authenticated services.
Examples: "Xfinity", "Comcast". |
| "c3.cm.categoryType" | string |
Content business categories of interest. Use this constant to assign content category labels, such as Audio, Trailer, Tile Play, or Short Video. Examples: "Episodic", "Movies", "News", "Sports", "Events", "Informercials", "Shorts", "Promos", "Audio", "Tile Play", "Short Videos", "Trailer". |
| "c3.cm.name" | string | Name of CMS Provider.
Examples: "CMS", "ROVI", "TMS". |
| "c3.cm.id" | string | Unique asset identifier to query CMS system to gather additional asset metadata information for a specific asset.
Example: "003b094d-fc5c-3d5a-8ed0-301bf848291e". |
| "c3.cm.seriesName" | string | The name of Series. Set the value only if the metadata cannot be gathered from CMS System. Null if not applicable.
Examples: "Friends", "Null". |
| "c3.cm.seasonNumber" | string | The Season number. Set the value only if the details cannot be inferred from Asset Provider Server. Null if not applicable.
Examples: "1", "Null". |
| "c3.cm.showTitle" | string | The name of the Episode or Show Title. Set the value only if the details cannot be inferred from Asset Provider Server. Null if not applicable.
Examples: "The One with All the Cheesecakes", "Null". |
| "c3.cm.episodeNumber" | string | The Episode number. Set the value only if the details cannot be inferred from Asset Provider Server. Null if not applicable.
Examples: "3", "Null". |
| "c3.cm.genre" | string | The Primary content genre. Set the value only if the details cannot be inferred from Asset Provider Server. Null if not applicable.
Examples: "Drama", "Null". |
| "c3.cm.genreList" | string | The list of the applicable content genre. Set the values in a comma separated list only if the details cannot be inferred from Asset Provider Server. Null if not applicable.
Examples: "Drama, Crime, Political, Violence", "Null" |
| "c3.cm.utmTrackingUrl" | string | Provide the UTM parameters in the URL to track the effectiveness of the online marketing campaign across traffic sources and publishing media. Conviva uses CONTAINS logic to parse the individual UTM parameters from the URL provided, so either the full URL or just the UTM parameters is acceptable.
Example values: This tag is only applicable for web and mobile devices. |
Constants for Pre-defined Metadata for Ads Only
Implement the pre-defined metadata specified in the table below.
These metadata tags shall be set via ccl_content_info_t* ad_content_info->tags object for ad session:
| Key | Type | Description |
|---|---|---|
| "c3.ad.technology" | string | Set the technology to which the ad belongs. Allowed values are "Server Side" and "Client Side". |
| "c3.ad.id" | string | The Ad ID extracted from the Ad Server that actually has the ad creative. For wrapper ads, this is the last Ad ID at the end of the wrapper chain. Example: "411687224". |
| "c3.ad.system" | string | The name of the Ad System (i.e. the Ad Server). This Ad System represents the Ad Server that actually has the ad creative. For wrapper ads, this is the last Ad System at the end of the wrapper chain. Set to "NA" if not available. Examples: "Freewheel", "Innovid", "Extreme IO", "NA". |
| "c3.ad.position" | string |
The position of the ad. Allowed values are "Pre-roll", "Mid-roll", and "Post-roll". |
| "c3.ad.isSlate" | string | A boolean value that indicates whether this ad is a Slate or not. Set to "true" for Slate and "false" for a regular ad. By default, set to "false". |
| "c3.ad.mediaFileApiFramework" | string | The name of the creative media framework. Generally used for VPAID ads. Set to "NA" for non-VPAID ads. Examples: "VPAID", "NA". |
| "c3.ad.adStitcher" | string | "The name of the Ad Stitcher. If not using an Ad Stitcher, set to "NA". Examples: "Uplynk", "Google DAI", "Google Anvato", "YoSpace", "NA". |
| "c3.ad.firstAdSystem" | string | Only valid for wrapper VAST responses. This tag must capture the "first" Ad System in the wrapper chain when a Linear creative is available or there is an error at the end of the wrapper chain. Set to "NA" if not available. If there is no wrapper VAST response then the Ad System and First Ad System should be the same. Examples: "GDFP", "NA". |
| "c3.ad.firstAdId" | string | Only valid for wrapper VAST responses. This tag must capture the "first" Ad Id in the wrapper chain when a Linear creative is available or there is an error at the end of the wrapper chain. Set to "NA" if not available. If there is no wrapper VAST response then the Ad Id and First Ad Id should be the same. Examples: "709684096", "NA". |
| "c3.ad.firstCreativeId" | string | Only valid for wrapper VAST responses. This tag must capture the "first" Creative Id in the wrapper chain when a Linear creative is available or there is an error at the end of the wrapper chain. Set to "NA" if not available. If there is no wrapper VAST response then the Ad Creative Id and First Ad Creative Id should be the same. Examples: "57861167296", "NA". |
| "c3.ad.creativeId" | string | The creative id of the ad. This creative id is from the Ad Server that actually has the ad creative. For wrapper ads, this is the last creative id at the end of the wrapper chain. Set to "NA" if not available. Examples: "57861167296", "NA". |
Device Metadata
The above section here prescribes how to implement platform metadata as a part of Platform Interface implementation. Device metadata is also used for inferring the device tags dimensions.
Custom Metadata
Refer to App Manager->Setup Metadata page for your account to find the custom tags which shall be implemented.
Set custom tags in a similar way for either video or ads, by using appropriate adAnalytics / videoAnalytics object and its corresponding method.
The API syntax can be found above in the corresponding sections for video and ads.
c3.cm format, for instance, c3.cm.MyCustomTag1. Conviva reserved the c3.cm naming convention for the pre-defined or required metadata.Update/Amend Metadata
To update or amend metadata for video or ads, use the method:
void ccl_session_update_content_info(ccl_session_t *session, const ccl_content_info_t *content_info)
sessionshall specify the correspondingccl_session_treference of ad or video session;content_infois the object containing the updated or amended metadata, for ads or video correspondingly.
The device metadata can be immediately set when the values are available.
IMPORTANT: Please note that different Conviva products, such as Conviva VSI and Conviva Viewer Insights may have different logic with respect to handling updated values. Conviva recommends to update the metadata only when it is available and do not set any default values before the metadata is available.
Ad Events and Metadata
Report Ad Break
This step is required to accurately report Video Startup Time. The time taken by the ad break shall not be counted towards VST. Notify Conviva sensor of the ad break events using the following APIs described below.
| Report ad break start |
|
Report ad start |
The ideal event for invoking this method is on main video pause, to clear stage for ad playback. |
|---|---|
Report ad end |
|
| Report ad break end |
|
The following steps are required when the video content contains pre-roll and mid-roll ads.
Handling Pre-Rolls
A common way to handle pre-roll ads is to preload the main content, pause it while the pre-roll ad plays, and then resume the main content after the pre-roll completes. Essentially, the ad plays while the main content is loaded. However, you don't want the play time for the ad to be counted as part of the Video Startup Time metric, nor do you want to be constantly polling the player while the ad runs.
The solution is to notify the Conviva layer of the pre-roll's existence and its start and end events. To notify the PodStart and PodEnd, call the ccl_session_send_event() API . The ccl_session_player_attach() call is deferred, and the ccl_session_ad_start() API is called with required parameter. When the Pre-roll ad ends, call the ccl_session_ad_end API and attach ccl_player_t, as shown in the following code example:
// Report ad break start
ccl_dictionary_t *attr = ccl_dictionary_create();
ccl_dictionary_put(attr, "adType", "Server Side");
ccl_session_send_event(video_session, "Conviva.PodStart", attr);
// Report ad start upon video pause or request for the ads
ccl_session_ad_start(video_session);
// ... Ad play
// Report ad end once ad is played
ccl_session_ad_end(video_session);
// Report ad break end
ccl_dictionary_put(attr, "adType", "Server Side");
ccl_session_send_event(video_session, "Conviva.PodEnd", attr);
// release the attribute
ccl_dictionary_destroy(attr);
// Attach content player to the video sesson to start monitoring
ccl_session_player_attach(video_session, ccl_player, player_data);
Handling Mid-Rolls
Ads played during the viewing of content are another case that needs to be handled correctly to maintain the accuracy of viewing metrics. For example, time spent viewing an ad should not be included in buffering ratio calculations. Likewise, your metrics would also be adversely affected by ending a session when an ad starts and starting a new session when it resumes.
The solution is detach the session when the main content stops and a mid-roll ad starts. To resume the session, you attach either the same player instance or a new player instance when the ad stops. Call ccl_session_ad_start() followed by session ccl_session_player_detach() when the main content stops and a Mid-roll ad starts. To resume session monitoring, attach the same ccl_player_t instance when the ad stops. To notify the PodStart and PodEnd, call the ccl_session_send_event() API.
The following API calls are needed to detach and re-attach the session to skip a mid-roll ad. These APIs are documented in the API Reference:
// As soon as the content is paused, call:
ccl_session_player_detach(ccl_session_t * video_session);
// Report ad break start
ccl_dictionary_t *attr = ccl_dictionary_create();
ccl_dictionary_put(attr, "adType", "Server Side");
ccl_session_send_event(video_session, "Conviva.PodStart", attr);
// Report ad start
ccl_session_ad_start(video_session);
// ... Ad play
// Report ad end once ad is played
ccl_session_ad_end(video_session);
// Report ad break end
ccl_dictionary_put(attr, "adType", "Server Side");
ccl_session_send_event(video_session, "Conviva.PodEnd", attr);
// release the attribute
ccl_dictionary_destroy(attr);
// Attach content player to the video sesson to start monitoring
ccl_session_player_attach(video_session, ccl_player, player_data);
Implement Ad Metadata
Implement pre-defined common metadata and pre-defined ad metadata following the corresponding specifications.
Report Ad Metrics
The ad metrics and ad video events shall be implemented in a similar way to the main video content - using ccl_player_t callbacks or ccl_notifier_t interface.
Refer to the above sections Init Interfaces and Report Metrics and events.
3. Report Events and Metadata
Manage Video Session
To create video session |
Use the following method to create Conviva monitoring session upon user playback request, along with metadata (content, workflow, audience, and other relevant metadata):
The keys / constants and expected values of the required metadata tags are defined in the Configure Metadata section. The sample code below illustrates video session creation:
IMPORTANT: It's critical to make this API call correctly to monitor video experience - monitoring session created from this moment, and key metrics are captured based on this event. For example, if this call done late (say, when video starts rather than user clicks 'play'), the Video Startup Time will be under-reported, Video Start Failures will be missed, etc. Please note that each video should be monitored separately - call this method for each new video played. IMPORTANT: If some of the content metadata tags aren't available at start, they can be set later or amended by Refer to the below table which prescribes when to invoke the corresponding API calls:
|
|||||||
|---|---|---|---|---|---|---|---|---|
|
To close video session |
Report end of playback by using the method:
|
Manage Ad Session
To create ad session |
Use the following method to monitor Ad video:
ad_content_info: pointer to the instance of cl_content_info_t, containing metadata.
- Returns: on success, pointer of ccl_session_t instance, on failure returns NULL.
The keys / constants and expected values of the required metadata tags are defined in the Configure Metadata section. IMPORTANT: This method shall be used for each ad pod in the ad break. E.g., if there are 3 ads in the ad break, create / close ad session 3 times. IMPORTANT: It's critical to make this API call correctly to monitor ad experience - monitoring session created from this moment, and key metrics are captured based on this event. For example, if this call done late (say, when ad starts rather than ad is requested), the Ad Startup Time will be under-reported, Ad Start Failures will be missed, etc. The sample code below illustrates ad session creation:
|
|---|---|
To close ad session |
Report end or skip of an ad by using the method:
|
Initialize Metric Reporting Interfaces
Initialize ccl_player_t |
The Conviva sensor uses As soon as The following sample code illustrates how to instantiate
The "get_*" callbacks above shall be implemented to report video or ad player metrics. Conviva sensor will be polling these methods periodically to receive current values. The detailed specification is provided here. |
|---|---|
Attach ccl_player_t to the session |
Once the
|
Implement start_monitoring() callback |
The Retain the pointer to the
The
|
Report Metrics and Events
Conviva C SDK is universal and player agnostic, therefore it can be used to integrate any video player / any platform in C language.
The video and ad events and metrics are repoted by two methods, following "push" and "pull" approach respectively.
"Push": directly set values of new metrics / report events from the application to the SDK. There are two ways to report the metrics: directly using the top-level
ccl_*methods, or viaccl_notifier_tinterface. To report metrics viaccl_player_tinterface, the instance of this object shall be attached to the current video or ad session, respectively."Pull": implement callbacks of the
ccl_player_tstructure, and return the metric values from the corresponding callback values.
The difference between the "push" and "pull" approaches is due to the metric nature. The event-driven metrics are reported directly via "push", while the metrics which instantly change during playback lifecycle (for example, buffer length) are collected via "pull" callbacks at a given frequency.
To report playback failures |
Example usage:
|
|||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
To report playback events |
To report metric events refer to the below table, which prescribes the required events and the corresponding API / method to report the metric. The below methods are called via the instance of
IMPORTANT: At any given time, a player can report the language of either the subtitles or the closed captions. When it reports one of them, the other language is set to off if it has already been reported. Report these languages (if they're available) on session start as well as when the user changes them on the current playback. Example:
If the audio, subtitle, or closed captions language option was initially enabled but later disabled, ensure to report the most recent language option value as off. Example:
|
|||||||||||||||||||||||||||
|
To implement callback metrics |
The following metrics are reported as a return value by corresponding callbacks of the
Refer to the below code sample for illustration of the callback metric implementation:
|
4. Handle User Actions
User Actions: Backgrounding
On backgrounding: set the player state to "paused".
On foregrounding: continue reporting player state changes / metrics in a regular way.
Report Network Metrics
Connection Type
It requires the application to detect the connection type and send through void ccl_notify_network_connection_type( const char * type ) API:
// The network connection type that the video player is using.
ccl_notify_network_connection_type ("WiFi");
The table below shows the representation string values for the setConnectionType() API:
| Internet Connection Type | Representation String |
|---|---|
| Wireless | WiFi |
| Wired | Ethernet |
| Cellular 2G | 2G |
| Cellular 3G | 3G |
| Cellular 4G | 4G |
| Cellular 5G | 5G |
| Other | OTHER |
If you can fetch wireless connection sub-type, such as "802.11 a", "802.11b", "802.11n", "802.11g", then pass the sub-type instead of "WiFi". If you can measure 4G data connection sub-type like "LTE", then pass the sub-type instead of "4G".
Signal Strength
Set the current WiFi signal strength of your device using the following method:
void ccl_notify_network_signal_strength(double signal_strength)
The value of the signal strength is a double in decibel-milliwatts (dBm) that your device detects.
Link Encryption
Set the current WiFi link encryption of your device using the following method:
void ccl_notify_network_wifi_link_encryption(const char *name) The values for the link encryption can be any string that your device detects, such as WPA2, WPA, EAP, WEP, NONE.
Report Custom Events
Player Insight is an advanced feature which allows you to track custom events that are not related to video rendering, but rather specific to your player's functionality. These events and their attributes are then tabulated in the Player Insight dashboard at Conviva VSI (Pulse). Contact your Conviva representative to enable Player Insights in Pulse.
You may send a custom Player Insight event that can be associated with a video playback using the following method:
Report video-related events by the method int ccl_session_send_event (ccl_session_t *session, const char *name, ccl_dictionary_t *attributes):
/* create an attribute */
ccl_dictionary_t *attr = ccl_dictionary_create();
ccl_dictionary_put(attr, "old_quality", "SD");
ccl_dictionary_put(attr, "new_quality", "HD");
ccl_dictionary_put(attr, "player", "STB player");
/* send the event */
ccl_session_send_event(video_session, "video_quality_change", attr);
/* release the attribute */
ccl_dictionary_destroy(attr);
Report app-level events by the method ccl_send_event (const char *name, ccl_dictionary_t *attributes):
// Sample for "share-click" event with 3 arguments
/* create an attribute */
ccl_dictionary_t *attr = ccl_dictionary_create();
ccl_dictionary_put(attr, "location", "Toolbar");
ccl_dictionary_put(attr, "assetName", "Sample Video");
ccl_dictionary_put(attr, "shareService", "Facebook");
/* send the event */
ccl_send_event("share_click", attr);
/* release the attribute */
ccl_dictionary_destroy(attr);
5. Cleanup
Releases the library and all tied up memory / resources |
|
|---|
Advanced Use Cases
You can use specific APIs in the Conviva sensor for various advanced use cases, such as:
Live or live linear streaming program changes
Video changes in the playlist
Playback does not recover from error and is reported once only
Multiple errors due to retry when playback does not recover
Playback recovers from a fatal error by switching to a different asset URL or CDN
A warning occurs when there's no impact on the playback
Handling user actions, such as user dialogues
To learn more about these advanced use cases, see here.
Self Validation
Upon completion of your integration, and before submission to Conviva QA team, developers should complete a comprehensive self-validation test pass of each Device Application.
Perform self-validation of video sensor integration using Touchstone in Pulse.
Conviva provides sample test cases with detailed steps and expected results.
Developers should be checking for both metric and metadata accuracy. Based on our experience, comprehensive self-validation can reduce your QE cycles, saving your costly project time.