Video Session API Diagram for JavaScript Chromecast CAF Module

## Integration Summary * ## Integration APIs **Initialize Objects** Conviva.

Updated 2026-06-30 api, table, modules, chromecast, caf, sensor developer center, sensor integration, javascript

Integration Summary

Integration API diagram

Integration APIs

**Initialize Objects**

Conviva.Analytics.init(customerKey, null, settings);

Initialize the top-level object.

Conviva.Analytics.buildVideoAnalytics();

This object needs to be instantiated once for each video playback, and is used to report the video-related events in an application. Typically, it is instantiated after the init() call, and ideally just before the user hits play.

videoAnalytics.setPlayerInfo(playerInfo);

Call this API to set the Predefined metadata.

Conviva.Analytics.setDeviceMetadata(deviceMetadata);

Call this API to set the Device metadata. To know about the values for device metadata constants, such as device Model and Category, refer to the API reference document, and search for the desired constant.

videoAnalytics.setContentInfo(contentInfo);

Call this API to update or amend metadata.

**Reports Events and Metadata**

videoAnalytics.setPlayer(cafPlayerManager);

Set Chromecast CAF player reference to Conviva video analytics object. If Core SDK and Chromecast CAF module are loaded in private scope instead of global scope, then pass the ChromecastCAF module object as the second argument:

videoAnalytics.setPlayer(cafPlayerManager, chromecastCAFModuleObj);

videoAnalytics.reportPlaybackRequested(/* object */ contentInfo);

Call this API when:

  • User clicks the video play button

  • Video starts in auto-play mode

  • User replays video

  • A new video starts in play list

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.

videoAnalytics.reportAdBreakStarted(/* Conviva.Constants.AdType / adType, / Conviva.Constants.AdPlayer */ adPlayer);

Required, if your application has Ads.

Inform videoAnalytics object that an ad break has been started.

videoAnalytics.reportAdBreakEnded();

Only applicable for custom ad integration, don't call for ad modules. For more details, refer to the Ad session diagrams.

videoAnalytics.reportPlaybackEnded();

Call this when the video play back ends.

**Report Playback Metrics**

videoAnalytics.reportPlaybackMetric(string key, Object val);

Most of the metrics such as player states, seek, buffering, are automatically collected.

However, there are these metrics that you need to report for Chromecast CAF module:

videoAnalytics.reportPlaybackMetric(Conviva.Constants.Playback.BUFFER_LENGTH, val);

Report the buffer length

videoAnalytics.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE, val);

Report frequently the rendered frame rate

videoAnalytics.reportPlaybackMetric(Conviva.Constants.Playback.CDN_IP, val);

Report the CDN IP address

videoAnalytics.reportPlaybackMetric(Conviva.Constants.Playback.AUDIO_LANGUAGE, "[en]:English");

At videostart and whenever audio language changes

videoAnalytics.reportPlaybackMetric(Conviva.Constants.Playback.SUBTITLES_LANGUAGE, "[en]:English");

At video start and whenever subtitles language changes

videoAnalytics.reportPlaybackMetric(Conviva.Constants.Playback.CLOSED_CAPTIONS_LANGUAGE, "[fr]:French");

At video start and whenever closed captions language changes

videoAnalytics.reportPlaybackMetric(Conviva.Constants.Playback.AVG_BITRATE, val);

At video start and frequently thereafter

**Report User Actions**

videoAnalytics.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED); Optional when the video playback request halts due to user dialogues like pin popup, accepting strong language or violence, or confirming age.

videoAnalytics.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_ENDED); Optional when the user wait time ends

Conviva.Analytics.reportAppBackgrounded(); To handle backgrounding events such as pressing home or power off buttons, or attending a phone call

Conviva.Analytics.reportAppForegrounded(); To handle foregrounding events

**Report Errors**

ChromecastCAF module auto-collects the reportPlaybackErrors. Need not report them.

videoAnalytics.reportPlaybackFailed(errorMessage, contentInfo);

When the playback has FATAL errors from which it does not recover, invoke this method, which internally closes the video session.

**Report Custom Playback Events**
videoAnalytics.reportPlaybackEvent(/* string */ eventType, /* object */ eventDetail)

For more details about the custom playback events, reach out to your Conviva representative.

**Cleanup Session**

videoAnalytics.release();

Conviva.Analytics.release();

Call these APIs to release the object on player's sudden exit, application's graceful exit, or when the Conviva object needs to be destroyed.