Conviva VSI Sensor Integration
Follow these instructions to complete the Conviva Stream Sensor integration on Rust players.
Step 1: Install Conviva Library
Developer Steps
Step 2: Configure Metadata
Developers Steps
Step 3: Report Events and Metadata
Developer Steps
Start monitoring the ads by calling
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
get_conviva_client()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
create_session(content_info)method to report playback attempt request along with metadata (content, workflow, audience, and other relevant metadata). - For the ads, start monitoring by calling
create_ad_session(ad_info, &mut video_session);for each ad in the ad break. - Use the
cleanup(&self)method to report the of end playback. - Create an instance of
CISPlayerIfobject to report video and ad related events (if your player has ads). - [Optional] Implement
start_monitoring()to report metrics.
Handle user actions such as backgrounding, user dialogue, pin popup according to the specification.
Report Network Metrics.
- Call
cleanup(&self){}to cleanup Conviva library, and release memory or 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.
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 Import Modules |
Download the Rust SDK library from the RUST SDK downloads page. Install the Conviva library and import these modules:
|
|---|---|
Initialize the Conviva Rust Client object |
Initialize the Conviva Rust Client by calling
gateway_url: Option: once enabled, the data will appear in Pulse for performing self-validation of video sensor integration. For more information, see Self-validation using Touchstone.
- enable_player_state_inference: By default, this field is *false*. When *false*, report the player state changes by calling the set_state() API. When updated to *True*, Conviva sensor infers the player state based on *Play Head TIme*, *Buffer Length*, *Frame Rate* and *Minimum Buffer Length*. You need not report the player state changes explicitly.
IMPORTANT: There's no need to explicitly set Expected Errors Due to Dual Stack IPv4/v6 Network Support When the Conviva sensor is initialized with production settings, the SDK sends a single request to the endpoints below:
[customer_key].ipv4.cws.conviva.com for IPv4 only [customer_key].ipv6.cws.conviva.com for IPv6 only 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
A complete example that runs on a Linux machine is included in the SDK inside test or sample-app folder. |
|
Implement Device Metadata |
While initializing Rust SDK through
|
| Call app_tick() method | To make the metrics data available for Conviva, call CISClient's app_tick() method for the following scenarios:
- Immediately after creating the Conviva client object
- After creating any video or ad session
- At regular intervals (recommended every 200ms)
|
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: Pre-defined, Device, and Custom.
|
Implement Video Metadata |
Implement pre-defined and custom tags for video by setting the properties of the An example to illustrate 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 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 CISContentInfo objects:
Constants for Pre-defined Metadata for Video and Ads
| Key / Constant | Type | Video | Ads |
|---|---|---|---|
| CISContentInfo.asset_name | Option |
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". |
| CISContentInfo.is_live | Option |
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. |
| CISContentInfo.player_name | Option |
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. |
| CISContentInfo.viewer_id | Option |
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. |
| CISContentInfo.stream_url | Option |
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. |
| CISContentInfo .default_resource | Option |
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. |
| CISContentInfo.duration | Option |
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" | Option |
Application build version. Ads and video have same values. |
Application build version. |
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
Set these metadata tags using video_content_info.tags object for video session:
Sample Code:
let mut tags: HashMap<String, CISGenericValueType> = HashMap::new();
tags.insert(
"c3.cm.channel".to_string(),
CISGenericValueType::CisStringValue("ABC".to_string()),
);
video_content_info.tags = Some(tags);
| 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 mentioned in the following table:
Set the metadata tags using ad_content_info.tags object for ad session:
Sample Code:
let mut tags: HashMap<String, CISGenericValueType> = HashMap::new();
tags.insert(
"c3.ad.technology".to_string(),
CISGenericValueType::CisStringValue("Client Side".to_string()),
);
ad_content_info.tags = Some(tags);
| Key | Type | Description |
|---|---|---|
| "c3.ad.technology" | string | Set the technology of the ad belongs to. Only allows the CISAdTechnology.CLIENT_SIDE/SERVER_SIDE values. Allowed values: "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. Only allows CISAdPosition.PREROLL/MIDROLL/POSTROLL values which are string constants of "Pre-roll", "Mid-roll", and "Post-roll" respectively. |
| "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 Implement Device Metadata section 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 -> Metadata page for your account to find the custom tags to be implemented.
Set custom tags in a similar way for either video or ads, by using appropriate video_content_info or ad_content_info object and its corresponding methods.
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:
pub fn update_content_info(&mut self, content_info: CISContentInfo) -> Result<(), CISError> {}
content_infois the object containing the updated or amended metadata, for ads or video.
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 (VST) that excludes the time taken by the ad break. Notify Conviva sensor of the ad break events:
| Report ad break start |
Sample code to illustrate the reporting of client-side and server-side ads: Client-side Ads
Server-side Ads
|
| Report ad break end |
|
|---|
The following steps are required when the video content contains pre-roll and mid-roll ads.
Handling Ad Breaks
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 . The attach() call is deferred, and the report_ad_break_started() API is called with required parameter. When the Pre-roll ad ends, call the report_ad_break_ended() API and attach CISPlayerIf, as shown in this example:
let pod_info_preroll = CISPodInfo {
pod_index: Some(1),
pod_position: Some(CISAdPosition::MidRoll),
pod_duration: Some(30),
};
let _ = video_session.detach();
let _ = video_session.report_ad_break_started(
CISAdPlayerType::Content,
CISAdTechnology::ClientSide,
Some(pod_info_preroll),
);
let _ = video_session.report_ad_break_ended();
interval.tick().await;
conviva_client.app_tick().await;
let _ = video_session.attach(Arc::downgrade(&player_if));
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):
Sample code to illustrate 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 calling Refer to the below table to know when to invoke the corresponding API calls:
|
|||||||
|---|---|---|---|---|---|---|---|---|
|
To close video session |
Report the end of playback:
|
Manage Ad Session
To create ad session |
Use the following method to create Ad session:
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. |
|---|---|
To close ad session |
Report end or skip of an ad:
|
Initialize Metric Reporting Interfaces
Initialize CISPlayerIf |
The Conviva sensor uses As soon as the Sample code to illustrate the instantiation of the
Implement the "get_*" callbacks above to report video or ad player metrics. Conviva sensor polls these methods periodically to receive the latest values. |
|---|---|
Attach CISPlayerIf to the session |
Once the
// Attach Player
|
Implement on_start_monitoring() callback |
The
To detach the player instance from the session, call the |
Report Metrics and Events
To report playback events |
To report metric events refer to the following table, which prescribes the required events and the corresponding APIs for either content session or ad sessions:
|
|||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
To report playback failures |
To report fatal errors or warnings, call the
|
|||||||||||||||||||||||||||||||||
To implement callback metrics |
The following metrics are reported as a return value by corresponding callbacks of the
|
4. Handle User Actions
Report Network Metrics
Connection Type
It requires the application to detect the connection type and send through set_network_connection_type API:
// The network connection type that the video player is using.
let _ = conviva_client.set_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:
let _ = conviva_client.set_network_connection_type("WiFi");
The value of the signal strength is a f32 in decibel-milliwatts (dBm) that your device detects.
Link Encryption
Set the current WiFi link encryption of your device using the following method:
let _ = conviva_client.set_network_wifi_link_encryption("WPA2");
The values for the link encryption can be any string that your device detects, such as WPA2, WPA, EAP, WEP, and 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:
pub fn send_event(
&mut self,
name: &str,
data: HashMap<String, CISGenericValueType>
) -> Result<(), CISError>;
Sample Code:
match video_session_result {
Ok(mut video_session) => {
let mut data: HashMap<String, CISGenericValueType> = HashMap::new();
data.insert(
"old_quality".to_string(),
CISGenericValueType::CisStringValue("SD".to_string())
);
data.insert(
"new_quality".to_string(),
CISGenericValueType::CisStringValue("HD".to_string())
);
let result = video_session.send_event("video_quality_change", data);
}
Err(error) => {}
}
Report app-level events by the send_event() method on CISClient object:
let mut data1: HashMap<String, String> = HashMap::new();
data1.insert("location".to_string(), "Toolbar".to_string());
data1.insert("assetName".to_string(), "Sample Video".to_string());
data1.insert("shareService".to_string(), "Facebook".to_string());
// Set the custom metadata
let result = conviva_client.send_event("share_click", Some(data1));
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.