logo

Conviva Integration for VideoAnalytics

This article describes on how to integrate Conviva pre-integration included inside THEOplayer SDK. A demo can be found at http://demo.theoplayer.com/conviva-analytics-test-page-20171024.

Table of Contents

SDKs

Web SDK Android SDK iOS SDK tvOS SDK Android TV SDK Chromecast SDK
Yes Yes Yes No Yes Unverified

Code example

Pre-requirements

Web SDK
  1. Have a THEOplayer SDK with the Conviva module enabled.
  2. Include Conviva's SDK. For example,
//Latest Conviva Library
<script
  type="text/javascript"
  src="//cdn.theoplayer.com/conviva/conviva-4.0.15.js"
></script>
Android (TV) SDK
  1. Have a THEOplayer SDK with the Conviva module enabled.
iOS (/tvOS) SDK
  1. Have a THEOplayer SDK with the Conviva module enabled.

Configuration

The snippets below explain how you can pass on Conviva settings to a THEOplayer configuration object.

Web SDK

A code example can be found at http://demo.theoplayer.com/conviva-analytics-test-page-20171024.

var convivaConfiguration = {
  integration: "conviva",
  customerKey: "<CUSTOMER_KEY>",
  gatewayUrl: "<GATEWAY_URL>",
  contentMetadata: {
    assetName: "<ASSET_NAME>",
    live: isLive,
    // "viewerId": "<VIEWER_ID>",
    // "defaultBitRateKbps": "<DEFAULT_BITRATE_KBPS>",
    // "defaultResource": "<DEFAULT_RESOURCE>",
    // "duration": 1000,
    // "encodedFrameRate": 30,
    // "applicationName": "<APPLICATION_NAME>"
    // "custom": {
    //  "<KEY>": "<VALUE>",
    // }
  },
};
player.source = {
  analytics: [convivaConfiguration],
  sources: [typedSource],
};
Android (TV) SDK

The snippet below is an example configuration for Conviva.

HashMap<String, String> customConvivaMetadata = new HashMap<>();
int defaultBitRateKbps = 1000,
    duration = 1000,
    encodedFrameRate = 30,
    heartbeatInterval = 5;
boolean isLive = false,
        isManualSessionControl = false;
customConvivaMetadata.put("<KEY>", "<VALUE>");
ConvivaConfiguration convivaConfiguration = new ConvivaConfiguration.Builder("customerKey",
    new ConvivaContentMetadata.Builder("<ASSET_NAME>")
        .applicationName("<APPLICATION_NAME>")
        .defaultBitrateKbps(defaultBitRateKbps)
        .defaultResource("<DEFAULT_RESOURCE>")
        .duration(duration)
        .encodedFrameRate(encodedFrameRate)
        .live(isLive)
        .viewerId("<VIEWER_ID>")
        .custom(customConvivaMetadata)
        .build())
    .gatewayUrl("<GATEWAY_URL>")
    .heartbeatInterval(heartbeatInterval)
    .manualSessionControl(isManualSessionControl)
    .build();

SourceDescription sourceDescription = SourceDescription.Builder.sourceDescription()
    .sources(typedSource)
    .analytics(convivaConfiguration)
    .build();
iOS (/tvOS) SDK

The snippet below is an example configuration for Conviva.

let isLive = false
let contentMetadata = ConvivaContentMetadata(
    assetName: "<ASSET_NAME>",
    live: isLive,
    // defaultBitrateKbps: defaultBitrateKbps,
    // defaultResource: "<DEFAULT_RESOURCE>",
    // duration: duration,
    // encodedFrameRate: encodedFrameRate,
    // applicationName: "<APPLICATION_NAME>",
    viewerId: "<VIEWER_ID>"
    // , custom: [:]
)

let convivaConfiguration = ConvivaConfiguration(
    customerKey: "876a2328cc34e791190d855daf389567c96d1e86",
    // heartbeatInterval: heartbeatInterval,
    gatewayURL: "https://theoplayer-test.testonly.conviva.com",
    contentMetadata: contentMetadata
    // , manualSessionControl: isManualSessionControl
)

let sourceDescription = SourceDescription(
        source: TypedSource(
        src: "https://cdn.theoplayer.com/video/elephants-dream/playlist.m3u8",
        type: "application/x-mpegurl"
    ),
    analytics: [convivaConfiguration]
)
github
Make sure to follow us on GitHub!
THEO-logo-white
twitter
facebook
linkedin
Copyright © 2020. All Rights Reserved.
Leuven
New York
San Francisco
Singapore
Barcelona