Quick Integration
The quick integration page for Android contains the code snippets that you'll need at various stages of integration and serves as a quick reference.
Follow these instructions to complete the Conviva Stream Sensor integration on Android players.
Step 1: Install Conviva Library
Developer Steps
Step 2: Configure Metadata
Developers Steps
Step 3: Report Events and Metadata
Developer Steps
Step 4: Integrate Video Players
Developer Steps
Step 5: Handle User ActionsUse Conviva methods to handle user actions, such as backgrounding and user events. Use Conviva methods to report custom events. Use Conviva methods to control data collection and delete collected data. Developer Steps
Step 6: 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.
Initialize the
ConvivaAnalyticsobject using your CUSTOMER_KEY.Create an instance of
ConvivaVideoAnalyticsas avideoAnalyticsobject to report video related events.If your player has ads: Create an instance of
ConvivaAdAnalyticsas aadAnalyticsobject to report ad related events.
Implement the metadata by following the instructions to use the pre-defined keys, as well as custom metadata, if applicable.
Implement device metadata (optional). By default, Conviva sensor autocollects Android device metadata.
Implement the videoAnalytics.reportPlaybackRequested(contentInfo) method to report playback attempt request along with metadata (content, workflow, audience, and other relevant metadata).
Use the videoAnalytics.reportPlaybackEnded() method to report the of end playback.
Integrate Video Players Add Conviva module dependency for your video player (if available), and pass player instance to Conviva by calling
videoAnalytics.setPlayer(playerInstance). If following custom integration guidelines, implement video events & metric reporting as prescribed by the corresponding specification. Add Conviva module dependency for your ad player (if available), and pass ad loader instance to Conviva by callingadAnalytics.setAdListener (adsLoader, settingsInfo);. If following custom integration guidelines, implement ad metadata, events & metric reporting as prescribed by the corresponding specification.
Implement the
ConvivaAnalytics.reportAppBackgrounded() / ConvivaAnalytics.reportAppForegrounded()methods to report background events.Implement
videoAnalytics.reportPlaybackEvent()method to report user events (user actions, user dialogue, etc).Set the permissions to enable the collection of Network Metrics, manage Data Collection and User Preferences.
Call 'release' methods to cleanup ConvivaAnalytics, videoAnalytics, adAnalytics objects upon application exit.
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 the Touchstone online tool to debug your implementation if required.
Be sure to replace your TEST CUSTOMER_KEY with the PRODUCTION key and go live with your application.**Make sure the GATEWAY_URL for Touchstone is NOT used in Production!
**Done! Analyse your data in Pulse and improve your viewer experience - let's make video experience better!
Sample Application
The sample application illustrating Conviva integration example for ExoPlayer can be found here.
Video Session API Diagram
To know the APIs that you need to integrate to monitor a video session, refer to the API diagram and the APIs listed in the table:
Integration APIs
Initialize Objects
|
Initialize the top-level object. |
|
Initialize the video object. |
|
Initialize the Ad object if your application has Ads. For more details, refer to the Ad session diagrams. |
|
Call this API to set the Predefined metadata. To know more, refer to the Configure Metadata section on this page. |
Call this API to set the Device metadata. For more details, refer to the Configure Metadata section on this page. |
|
Call this API to update or amend metadata. To know more, refer to the Configure Metadata section on this page. |
Report Events and Metadata
|
Call this API when:
It's critical to make this API call correctly to monitor the video experience. For example, if the call is delayed (say, when the video starts rather than the user clicking play*), the Video Startup Time will be under-reported and the Video Start Failures will be missed. |
|
Required, if your application has Ads. Inform videoAnalytics object that an ad break has been started. |
|
Required, if your application has Ads. Call this API when the ad break ends. |
|
Call this when the video play back ends. |
|
Only applicable for custom ad integration, don't call for modules. For more details, refer to the Ad session diagrams. |
Report Playback Metrics
|
Call this API to report metric events such as a change in the player state, and buffer length. For custom integrations, report these metric events during video playback: For modules such as Brightcove and Exoplayer, most of these metrics are automatically collected. For more details, refer to the Report Playback Metrics and Implementing Callback Function sections on this page. |
Report User Actions
|
|
|
|
|
|
|
|
Report Errors
|
Call this when the playback encounters a fatal error from which it does not recover and reported only once. |
|
Call this when the playback does not recover from error and fatal errors are reported multiple times. |
Cleanup Session
|
Call these APIs to release the objects on application exit, or when the Conviva object is destroyed. |
1. Install Conviva Library
Conviva provides a library plugin to help automate library installation and sensor integration with Android players. Alternatively, you can install the libraries manually and follow the step-by-step integration process.
Install and Integrate Using Conviva Library Plugin
Conviva provides an integration assistant plugin to help automate the stream sensor integration with Android players. Use the plugin for faster integration with Gradle dependency syncs and a generated Java Helper class.
Install Conviva Library Using Plugin
These steps help you install the plugin and integrate the Android players.
Downloading and Installing the Plugin
Download the plugin, ConvivaPlugin-SNAPSHOT.zip.
Open Android Studio on your computer.
1. To install the plugin, close all the files on Android studio, and drop the zip file from the downloaded folder to the file area in the Android Studio. You can also open the file from Files->Preferences/Settings->Plugin->Install Plugin from Disk...
1. Click Restart when the studio prompts for a restart.
1. The plugin gets installed with this restart. Click Conviva Integration Assistant to see it in the studio sidebar. You can also add the plugin to the sidebar from Tools menu.
*
- Choose the SDK to integrate. The plugin supports Core SDK, ExoPlayer, BrightCove, NexPlayer, and IMA modules.
- To install the Core SDK library, click Integrate theConvivaCore SDK* and choose the SDK version. If you choose the ExoPlayer SDK , then the click Integrate the ExoPlayer SDK. This action starts the Gradle sync to add dependencies to your project.
*
- Click Generate Helper Class* and enter values for test and production customer keys, and validation URL. Choose a directory (usually, your project package) to save the helper class file. For example:
com.mypackage.MyExample.java
com.mypackage.ConvivaHelper.java
*1. This generates ConvivaHelper.java file with all the code snippets required for integration.
- Invoke the helper class methods from your package. For example:
ConvivaHelper convivaHelper = new ConvivaHelper();
//Builds and returns the ConvivaVideoAnalytics object.
convivaHelper.buildVideoAnalytics();
//Builds and returns the ConvivaAdAnalytics object.
convivaHelper.buildAdAnalytics();
- Advanced Use Cases* are also available on the plugin for your reference.
*1. The integration is complete; perform self validation using Touchstone. For more details, refer to the Self Validation section.
If not using the plugin, you can also install the libraries manually and follow the step-by-step integration process.
Add Conviva Libraries and Configure Dependencies
jcenter() repository in your root file to automatically install Conviva dependencies via Gradle.|
Add core SDK |
Or download and add the library explicitly from Conviva GitHub: https://github.com/Conviva/conviva-android-coresdk |
|---|---|
|
Add dependencies |
If using one of the players Conviva provides a module for, add the corresponding dependency as well.
If you are using shrinkResources or minifyEnabled properties in the application to optimize the size of the APK file, then add the following in ProGuard rules:
-keep class com.conviva. { *; } |
|
Add dependencies for Ad SDKs |
Refer to Integrate Ad Managers for the details of ad manager integration.
Or download and add the library explicitly from Conviva GitHub: https://github.com/Conviva/conviva-android-imasdk. |
|
Initialize the top level object |
The allowed parameters are:
- IMPORTANT: No need to set
|
|---|---|
Initialize the video object |
Create instance of This object will be used throughout the entire application lifecycle to report video related events.
|
Initialize the ad object |
Only if your application has ads, create This object will be used throughout the entire application life cycle to report ad related events.
This method requires |
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).
Pre-defined Video and Content Metadata
Conviva defines the constants or fixed string keys for commonly used metadata. These metadata keys provide critical information about video, content, ad content, versioning, and workflow.
The table below provides the pre-defined metadata fields.
IMPORTANT: Conviva modules for video players only capable of autocollecting FRAMEWORK_VERSION and FRAMEWORK_NAME. The rest of the metadata shall be set by your application.
The constants below are defined in the class com.conviva.sdk.ConvivaSdkConstants.
Constants for Pre-defined Video and Content Metadata
| Key | Type | Implementation Note |
|---|---|---|
| ConvivaSdkConstants.ASSET_NAME | string | Use 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:
|
| ConvivaSdkConstants.IS_LIVE | boolean | Denotes whether the content is video on-demand or a live stream. Affects the computation and availability of the Conviva metrics.
boolean true/false |
| ConvivaSdkConstants.PLAYER_NAME | string | 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: for example, "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. |
| ConvivaSdkConstants.VIEWER_ID | string | 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. |
| ConvivaSdkConstants.STREAM_URL | string |
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 all lowercase are acceptable. |
| ConvivaSdkConstants.DEFAULT_RESOURCE | string |
This value specifies the video server or CDN name from where the streaming resource is played. 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).
|
| ConvivaSdkConstants.DURATION | integer | Duration of the video content, in seconds. |
| ConvivaSdkConstants.ENCODED_FRAMERATE | integer | Encoded frame rate of the video stream in frames per second. |
| ConvivaSdkConstants.FRAMEWORK_NAME | string |
Video Player Framework Name. Autocollected if Conviva module used for video player integration, required for custom integration. videoAnalytics.setPlayerInfo(Map:
|
| ConvivaSdkConstants.FRAMEWORK_VERSION | string |
Video Player Framework Version. Autocollected if Conviva module used for video player integration, required for custom integration. videoAnalytics.setPlayerInfo(Map:
|
| "c3.app.version" | string | Application build version. Shall have the same value for both ads and video. |
| "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.
Examples: "Episodic", "Movies", "News", "Sports", "Events", "Informercials", "Shorts", "Promos". |
| "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. |
Device Metadata
By default, Conviva Android SDK autodetects device metadata for Android OS. Device metadata is also used for inferring the device tags dimension. However, if a device is built on a customized version of Android, or certain device information needs to be customized (for example, model or manufactured for Android-based STB), the below API can be used.
We recommend consulting to your Conviva representative in case you decide to customize your device metadata. Device metadata may or may not be auto-collected by Conviva. For Android, Conviva auto-detects device metadata. Device metadata is also used for inferring the device tags dimensions. If you're implementing Conviva on a Set Top Box or other custom Android device, check the aspects of implementation with your Conviva representative, as it may require setting custom device metadata.
Device Metadata Instructions (Click to Expand):
Map<String, Object> deviceInfo = new HashMap<>();
deviceInfo.put(ConvivaSdkConstants.DEVICEINFO.DEVICE_BRAND, "Google");
// set the rest of the required metadata fields as per the table below
ConvivaAnalytics.setDeviceInfo(deviceInfo);
The table below provides the list of pre-defined metadata for device metadata.
| Key | Type | Description | Example Value |
|---|---|---|---|
| ConvivaSdkConstants.DEVICEINFO.ANDROID_BUILD_MODEL | string | Android build model | "PIXEL 3 XL" |
| ConvivaSdkConstants.DEVICEINFO.OPERATING_SYSTEM_VERSION | string | OS version | "10" |
| ConvivaSdkConstants.DEVICEINFO.DEVICE_BRAND | string | Device Brand | "Google" |
| ConvivaSdkConstants.DEVICEINFO.DEVICE_MANUFACTURER | string | Device manufacturer | "Google" |
| ConvivaSdkConstants.DEVICEINFO.DEVICE_MODEL | string | Device Model | "PIXEL" |
| ConvivaSdkConstants.DEVICEINFO.DEVICE_TYPE | string | Device type | "Mobile" |
| ConvivaSdkConstants.DEVICEINFO.DEVICE_VERSION | string | Device version | "3" |
Custom Metadata
Custom metadata that allows the implementation of your custom tag keys, specific to your business requirement, for either video or ad content.
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 adding the tags to the contentInfo or adInfo objects, passed into corresponding methods of videoAnalytics / adAnalytics objects.
Update/Amend Metadata
The device metadata can be immediately set when the values are available.
To update or amend pre-defined and custom tags for video, use the videoAnalytics.setContentInfo(contentInfo) object containing the key - value pairs of metadata tags for video content.
Example usage:
Map<String, Object> contentInfo = new HashMap<>();
contentInfo.put(ConvivaSdkConstants.ASSET_NAME, "[channel_id] Live Channel Name");
// set the values for the other pre-defined keys as appropriate, refer to the tables below
contentInfo.put("c3.cm.contentType", "Live-Linear");
// set the values for custom tags as required per definition for your account
contentInfo.put("my_custom_tag_key", "my_custom_tag_value");
videoAnalytics.setContentInfo(contentInfo);
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.
3. Report Events and Metadata
Report Video Play Start
For each video play, report playback attempt requests |
where 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 Please note, in most cases that it's required to set content metadata before the player reports "play" for the first time, to accurately attribute metadata to the video asset.
|
Report Ad Breaks to Video Session
IMPORTANT:The SDK autodetects the reportAdBreakStarted() / reportAdBreakEnded() events in case of the Conviva Ad Modules used.
Report Ad Break |
To handle ads, inform videoAnalytics object that ad break is started: videoAnalytics.reportAdBreakStarted(ConvivaSdkConstants.AdPlayer adPlayer, ConvivaSdkConstants.AdType adType)
The ideal event for invoking this method is on main video pause, to clear stage for Ad playback. If the same video player instance used for ads as for the video, call it when application requests the ads. Refer to the below sample code for illustration of how reporting shall be done in these scenarios: Client-side Ads
Server-side Ads
On ad break ended
|
|---|
Report Video Play End
| For each video play end, report playback ended |
|
4. Integrate Video Players
Conviva core SDK is universal and player agnostic, therefore it can be used to integrate any video player using the programming language it's written for.
For ease and speed of integration, Conviva also provides plug-in modules for the most commonly used video players.
The modules allow to auto-detect events from the particular player.
If instructions for your player are not shown below, please follow the instructions for "Custom Integration", or contact your Conviva representative.
Exoplayer
Conviva ExoPlayer module auto-detects events emitted by ExoPlayer. Therefore, it's not necessary to report these events explicitly by using "reportPlaybackMetric()" API. It's still required to report application events such as backgrounding, metadata, session close, ad-related events.
Add the Conviva ExoPlayer module dependency |
As there are backward compatibility issues with different versions of ExoPlayer, we recommend to pick the correct version of Conviva Module by referring to the release notes and the Exoplayer version that your application is using. Release Notes: https://github.com/Conviva/conviva-android-exoplayer/blob/master/CHANGELOG.md Or download and add the library explicitly from https://github.com/Conviva/conviva-android-exoplayer/releases |
||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Set player reference to Conviva videoAnalytics |
Starting that moment, Conviva library will listen for all relevant events automatically. Please include the Metrics monitored by Conviva ExoPlayer module (if applicable):
|
||||||||||||||||||||||||||||||
Implement Metadata |
Metadata monitored by Conviva ExoPlayer module (if applicable):
To implement the rest of metadata, refer to the above sections common pre-defined, pre-defined video, and custom metadata definitions for implementation details. |
Known ExoPlayer Limitations
| Metric | Impact | Conditions | Issue |
|---|---|---|---|
| Average Bitrate | Under reported | HLS Demuxed Streams | Player reports video bitrate but reports 0 for audio. |
| Over reported | AVERAGE-BANDWIDTH unavailable | Player reports peak bitrate if average bitrate information is unavailable in manifest file. |
Custom Integration
Conviva sensor can be used to integrate video players using explicit metric reporting using the ConvivaVideoAnalytics class methods.
The major steps required are listed below.
Report playback failures |
To report fatal playback error AND quit the session:
To report fatal playback error AND keep the session open (e.g., in case of player internal re-try or fallback logic):
The argument Example usage:
|
||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Report playback metrics |
To report metric events:
It accepts multiple/zero values for the second argument. The values of the supported "key" argument are defined as Conviva constants (see the below table). The keys are pre-defined in the Example usage:
The table below defines the events required to be implemented, with the corresponding parameters for each event key.
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:
|
||||||||||||||||||||||||||||||||||||||||||
|
Implement Callback function for polled metrics |
There are certain metrics which do not have events, hence SDK provides a callback to update these values at a certain frequency.
Once Since this API callback is called every 1 sec, it is recommended that no other metrics than the one specified be updated. It must not retain strong references to instances in outer scopes.
|
||||||||||||||||||||||||||||||||||||||||||
Implement Metadata |
For Custom Integration, Conviva sensor does not capture any metadata automatically. Refer to the above sections common pre-defined, pre-defined video, and custom metadata definitions for implementation details. |
NexStreaming
Conviva NexStreaming module auto-collects video events emitted by the NexStreaming player. Therefore, it's not necessary to report these events explicitly by using "reportPlaybackMetric()" API. It's still required to report application events such as backgrounding, metadata, session close, ad-related events.
Add the Conviva NexStreaming module dependency |
To download and add the library explicitly from Conviva GitHub, refer: |
||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Set player reference to Conviva videoAnalytics |
Starting at that moment, Conviva library will listen for all events automatically. Metrics monitored by Conviva NexStreaming module (if applicable):
|
||||||||||||||||||||||
Implement Metadata |
Metadata monitored by Conviva NexStreaming module (if applicable):
To implement the rest of metadata, refer to the above sections common pre-defined, pre-defined video, and custom metadata definitions for implementation details. |
Known NexStreaming Limitations
| Metric | Impact | Conditions | Issue |
|---|---|---|---|
| Play State | Over reported | Pause on low bandwidth | When the user pauses the content due to low bandwidth, the player reports PLAY state before reporting PAUSE state. |
| Pause State | Under reported | Pause on low bandwidth | When the user pauses the content due to low bandwidth, the player reports PLAY state before reporting PAUSE state. |
| Rebuffering Ratio | Under reported | Progressive Download (MP4) on low bandwidth | When the user seeks under low bandwidth, the player freezes, but starts reporting a PLAY state and sends onBufferingEnd(). In this scenario, Conviva buffering metrics are under-reported. |
| Video Restart Time (VRT) | Not reported | Progressive Download (MP4) on low bandwidth | When the user seeks under low bandwidth, the player freezes but starts reporting a PLAY state and sends onBufferingEnd(). In this scenario, VRT will not be reported. |
| Average Bitrate | Incorrect | HLS Demux Stream | When playing a HLS demux stream, the player reports incorrect audio bitrate. |
Brightcove
Conviva Brightcove module auto-detects events emitted by Brightcove player. Therefore, it's not necessary to report these events explicitly by using "reportPlaybackMetric()" API. It's still required to report application events such as backgrounding, metadata, session close, ad-related events.
Add the Conviva Brightcove module dependency |
To download and add the library explicitly from Conviva GitHub, refer: |
||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Set player reference to Conviva videoAnalytics using this API |
The argument Starting that moment, Conviva library will listen for all relevant events automatically. Metrics monitored by Conviva Brightcove module (if applicable):
|
||||||||||||||||||||||||||||||
Implement Metadata |
Metadata monitored by Conviva Brightcove module (if applicable):
To implement the rest of metadata, refer to the above sections common pre-defined, pre-defined video, and custom metadata definitions for implementation details. |
Known Brightcove Limitations
| Metric | Impact | Conditions | Issue |
|---|---|---|---|
| Subtitle and Audio Languages | Reported Same | BrightcoveExoPlayerVideoView | For subtitles and closed captions, the player reports language code for both the code and name fields, for example, [en]:en, [fr]:fr, or [es]:es. |
| Not Autocollected | BrightcoveExoPlayerVideoView | The selection of *none* or *off* for subtitles or closed captions is not auto-collected. | |
| Average Bitrate | Not reported |
|
Bitrate information cannot be automatically detected via the API. |
| Under-reported | BrightcoveExoPlayerVideoView for HLS Demuxed Streams. | Player reports video bitrate but reports 0 for audio. | |
| Video Playback Failures (VPF) | Under-reported | BrightcoveExoPlayerVideoView/BrightcoveVideoView URL unreachable for MP4. | When the URL is unreachable mid-stream, the player does not report any fatal errors for MP4 streams. |
| CDN IP | Not reported | BrightcoveVideoView | CDN Edge Server IP auto detection is not supported for BrightcoveVideoView player.
CDN Edge Server IP auto collection is supported for BrightcoveExoPlayerVideoView player. |
|
Seek Events (PSS & PSE) |
Over reported | BrightcoveVideoView or BrightcoveExoPlayerVideoView |
Multiple PSS and PSE events are reported when we seek through the seek bar after:
|
| Dropped Frame Count | Not reported | BrightcoveVideoView |
Dropped Frame Count auto detection is not supported for BrightcoveVideoView player. Dropped Frame Count auto collection is supported for BrightcoveExoPlayerVideoView player. |
Integrate Ad Managers
Conviva core SDK is universal and player agnostic, therefore it can be used to integrate any Ad SDK using the programming language it's written for.
For ease and speed of integration, Conviva also provides plug-in modules for the most common Ad SDKs.
The modules allow to auto-detect events from the particular player / Ad SDK.
If instructions for your Ad SDK are not shown below, please follow the instructions for "Custom Ad Manager" integration, or contact your Conviva representative.
Google IMA/DAI
Conviva provides the module to auto-detect ad events emitted by the Google IMA SDK. Therefore, it's not necessary to report these events explicitly by using core SDK APIs. It's still required to report application events such as backgrounding.
Add the Conviva IMA/DAI module dependency |
Or download and add the library explicitly: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Set Ad Listener to AdAnalytics |
To enable Ad metric & metadata auto-detection, pass the adsLoader instance of the IMA SDK to Conviva adAnalytics:
Starting that moment, Conviva IMA/DAI module will listen for all relevant events automatically. The constants below are defined in the class Metrics monitored by Conviva Google IMA module (if applicable):
Metrics monitored by Conviva Google DAI module (if applicable):
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Implement Ad Metadata |
Conviva defines the set of the metadata keys to be used for metadata implementation. The implementation can be extended by adding custom tags - refer to Custom Metadata section. The Conviva IMA/DAI module automatically collects the available values for some of the metadata tags from the IMA SDK. Some of the tags though still have to be explicitly implemented. Please refer to the table below for the metadata tag definitions and details of the implementation. No action required if implementation note says "Autocollected".
Pre-defined Ad Metadata:
|
adAnalytics.reportAdMetric(ConvivaSdkConstants.PLAYBACK.BITRATE, 1024);
Refer to the list of metric keys to be implemented in the table below:
| Key | Type | Implementation Note |
|---|---|---|
| ConvivaSdkConstants.PLAYBACK.PLAYER_STATE | *enum ConvivaSdkConstants.PlayerState.* | Any player state changes such as Playing, Buffering, Paused shall be reported to CONVIVA SDK. |
| ConvivaSdkConstants.PLAYBACK.BITRATE | *int (kbps)* | Report new bitrate value on change event (video + audio, or video only if audio isn't available) |
| ConvivaSdkConstants.PLAYBACK.SEEK_STARTED | *Optional: int (ms)* | Start of seeking or scrubbing by user. If seek position is known, report as the method argument. |
| ConvivaSdkConstants.PLAYBACK.SEEK_ENDED | no argument | End of seeking or scrubbing by user |
| ConvivaSdkConstants.PLAYBACK.PLAY_HEAD_TIME | *long (ms)* | Current playback position. |
| ConvivaSdkConstants.PLAYBACK.BUFFER_LENGTH | *long (ms)* | Report current Buffer length of the player. |
| ConvivaSdkConstants.PLAYBACK.RENDERED_FRAMERATE | *long (fps)* | Rendered framerate in fps. |
| ConvivaSdkConstants.PLAYBACK.CDN_IP | string (IP address) | CDN IP address in string format. |
| ConvivaSdkConstants.PLAYBACK.DROPPED_FRAMES_COUNT | int (drop frame count) | Report periodic dropped frames count for a specific time interval. |
5. Handle User Actions
Handle specific user actions such as:
app backgrounding / foregrounding
dialogues
pin popups
startover dialogues
video slates, and so on
Use the corresponding API as prescribed on the corresponding pages.
User Actions: Backgrounding
|
Handle backgrounding event (e.g., "home"/"power off" buttons) |
|
|---|---|
|
On foregrounding |
|
User Actions: User Dialogue
User Dialogues such as:
pin popup
accepting strong language / violence
confirming age
startover / resume dialogue
|
Use this API on dialogue shown |
|
|---|---|
| Use this API on dialogue dismiss |
|
Data Saver
The Conviva sensor is designed in accordance with the Data Saver capabilities of Android N. When a user enables Data Saver in Settings and the device is on a metered network, the system blocks background data usage and signals apps to use less data in the foreground wherever possible.
If Data Saver setting is enabled and the app is in the allowed list, the Conviva sensor will continue to send heartbeats as the application is allowed to use data even on metered network. But if the app is not in the allowed list or is blocked, no heartbeat will be sent in the foreground as well as the background.
Report Network Metrics
If the necessary permissions are not added in the application's manifest file, the Conviva library will report the default values, after performing the necessary security checks.
To enable the Conviva library to collect the network metrics, the application must follow the Android permission instructions provided below
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
In Android M and later versions (API 23 and above), please add a runtime permission request for
android.permission.ACCESS_COARSE_LOCATION.In Android Q and later versions (API 29 and above), please add a runtime permission request for
android.permission.ACCESS_FINE_LOCATION.
For more details, see Android permissions.
if (Build.VERSION.SDK_INT >= 23) {
if (!(checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
requestPermissions(new String[]{Manifest.permission.ACCESS_COARSE_LOCATION}, 0);
}
}
if (Build.VERSION.SDK_INT >= 29) {
if ( !(checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 0);
}
}
List of metrics that require permissions and collection:
| Metric | Permission Required | Automatically Collected |
|---|---|---|
| Data Saver | android.permission.ACCESS_NETWORK_STATE
|
No |
| Connection Type | android.permission.ACCESS_NETWORK_STATE
|
Yes The Conviva sensor will report raw values returned by the Connection Type. Connection type can be updated after session creation, before the first video frame is rendered. |
| Link Encryption | android.permission.ACCESS_WIFI_STATE
|
Yes Link Encryption is unavailable since Android Q. |
| Wi-Fi Signal Strength | android.permission.ACCESS_WIFI_STATE
|
Yes
Android SDK reports signal strength in decibel-milliwatts (dBm). If the information is not available, the default value is 1000. |
| Cellular Signal Strength | android.permission.ACCESS_COARSE_LOCATION
|
Yes
Android SDK reports signal strength in decibel-milliwatts (dBm). If the information is not available, the default value is 1000. |
Cellular Signal Strength for WCDMA
Android SDK provides support for WCDMA signal strength from Android API 18 onwards, therefore Conviva sensor will not be able to report it below API level 18.
Android L devices: Signal strength information for cellular networks in not available in Android L devices therefore Conviva sensor will not be able to report it. This is also captured as Google Android Issue: 60430.
Android Q and above devices: With the release of Android 29, the functionality of the
getAllCellInfo()API used for fetching the cellular networks signal strength information has changed. Your applications must add a new permissionACCESS_FINE_LOCATIONfor all devices using Android Q and above.
|
Declare tools under manifest root tag |
|
|---|---|
|
Add permissions to be excluded |
|
Network Type
In most cases, the Conviva library will automatically detect the network type. It will return raw values, based on the mappings below.
| Raw Value (String) | Significance | Mapping |
|---|---|---|
| 0 | NETWORK_TYPE_UNKNOWN | Unknown |
| 1 | NETWORK_TYPE_GPRS | 2G |
| 2 | NETWORK_TYPE_EDGE | 2G |
| 3 | NETWORK_TYPE_UMTS | 3G |
| 4 | NETWORK_TYPE_CDMA | 2G |
| 5 | NETWORK_TYPE_EVDO_0 | 3G |
| 6 | NETWORK_TYPE_EVDO_A | 3G |
| 7 | NETWORK_TYPE_1xRTT | 3G |
| 8 | NETWORK_TYPE_HSDPA | 3G |
| 9 | NETWORK_TYPE_HSUPA | 3G |
| 10 | NETWORK_TYPE_HSPA | 3G |
| 11 | NETWORK_TYPE_IDEN | 2G |
| 12 | NETWORK_TYPE_EVDO_B | 3G |
| 13 | NETWORK_TYPE_LTE | 4G |
| 14 | NETWORK_TYPE_EHRPD | 3G |
| 15 | NETWORK_TYPE_HSPAP | 3G |
| 16 | NETWORK_TYPE_GSM | 2G |
| 17 | NETWORK_TYPE_TD_SCDMA | 3G |
| 18 | NETWORK_TYPE_IWLAN | IWLAN |
| 20 | NETWORK_TYPE_NR | 5G |
| WiFi | CONNECTION_TYPE_WIFI | WiFi |
| Ethernet | CONNECTION_TYPE_ETHERNET | Ethernet |
| OTHER | CONNECTION_TYPE_OTHER | OTHER |
Data Collection and User Preferences
By default, Conviva collects a set of data for better user analytics. However, the appropriate legal agreement with Conviva is required in order for Conviva to begin collecting data that would be considered PII, personal information, personal data or the like under applicable data privacy laws such as the General Data Protection Regulation (GDPR) and the California Consumer Privacy Act (CCPA). Further below in this document, there is a description of the user-preference APIs that control data collection, including opt-out and deletion of data, in compliance with data privacy laws. These APIs are in addition to existing, offline processes for opt-out and data deletion requests.
This document describes the identifiers that the libraries are capable of collecting, however actual collection of identifiers is contingent upon the customer's legal department providing written instructions to Conviva to begin collection. At the discretion of the customer's legal department, some or all of these identifiers may be collected. Conviva provides this flexibility to allow the customer to determine the precise identifiers to be collected.
Following tags are used to collect data:
- Android OS
androidId: Android ID is unique to each application on a device and valid until factory reset. -gsfId: Google Service Framework ID which is provided by Play services framework. -gaId: Google Ad identifier provided by Google Play Service framework.- Fire OS
fireAdId: Amazon Ad identifier provided by Amazon FireOS.
To retrieve the Google Service Framework ID, the following permission needs to be declared in the manifest.
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
|
Control the data collection |
|
|---|
Set user preferences to opt-out of data collection by specifying the corresponding tag to true/false. By default, Conviva assumes no restriction in collecting data.
where data is the Key/Value pair, where key indicates a probable data name and value is true/false. A value of true causes the SDK to allow collecting the data item and a value of false causes the SDK to stop collecting the data item.
Map<String, Boolean> data = new HashMap<>();
data.put("androidId", allowAndroidId); //allowAndroidId is true/false based on user preference.
data.put("gsfId", allowGsfId); // allowGsfId is true/false based on user preference.
data.put("gaId",allowGaId); // allowGaId is true/false based on user preference.
ConvivaAnalytics.setUserPreferenceForDataCollection(data);
|
Delete collected data |
|
|---|
Delete previously collected data and opt-out of data collection by specifying the corresponding tag. By default, Conviva assumes no deletion of data.
where data is the Key/Value pair, where key indicates a probable data name and value is true/false. A value of true causes the SDK to delete and stop collecting that specific data item.
Map<String, Boolean> data = new HashMap<>();
data.put("androidId", deleteAndroidId); // deleteAndroidId is true/false based on user preference.
data.put("gsfId", deleteGsfId); // deleteGsfId is true/false based on user preference.
data.put("gaId",deleteGaId); // deleteGaId is true/false based on user preference.
ConvivaAnalytics.setUserPreferenceForDataDeletion(data);
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 videoAnalytics.reportPlaybackEvent(String eventType, Map
|
Report video-related events |
|
|---|
Report app-level events by the method ConvivaAnalytics.reportAppEvent(String eventType, Map:
|
Report app-level events |
|
|---|
6. Clean Up Session
After the player session ends, use report and release methods to end object reporting.
At video playback end, call |
|
For Ad content, call |
|
On application exit, or when the Conviva object is destroyed, release the objects |
|
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
- Warning occurs when there's no impact on the playback
- Handling user actions, such as user dialogues, backgrounding, and foregrounding
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.
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.
For more information about self-validating the builds, downloading the test cases, and viewing sample validation videos, refer to the Self-Validation page.
Type to search. Results appear as you type.