The Video Analytics SDK empowers your applications with advanced video analytics capabilities, enabling you to gather valuable insights into viewer behavior. By leveraging powerful analytics tools and data collection mechanisms, it provides a comprehensive analysis of viewer interactions and preferences, allowing you to make data-driven decisions for optimizing the viewer experience and content delivery.

Before you proceed with the setup, make sure you have the following prerequisites in place:

  • Android Studio (for Android)

Getting Started

Downloading the SDK

To begin, download the SDK for your respective platform: 

Android SDK Setup

Now, follow these steps to initialize the SDK in your Android application:

Step 1: Add the library to your application

Step 2: Initiate a StyledPlayer View component within your Android application’s layout XML file, serving as the user interface element for video playback.

playerView = findViewById(R.id.player_view);

Step 3: Generate unique identifiers (viewerID and viewID) and specify a user agent (userAgent) for your application using custom libraries provided by the SDK

String viewerID = new DeviceUUIDFactory(this) .getDeviceUuid().toString():

String viewID = new ViewIDGenerator() .generate();

String userAgent = new UserAgentGenerator(this).generateUserAgent();

Step 4: Initiate the FCCDNAnalyticsConfig class and configure parameters within the FCCDNRequest object, including hash ID, video title, tags, URL, and other request-specific values for video analytics.

4.1: Initialize FCCDNAnalyticsConfig

FCCDNAnalyticsConfig fccdnAnalyticsConfig = new FCCDNAnalyticsConfig("hash_id", this);

4.2: Set analytics title

fccdnAnalyticsConfig.setTitle("5CentsCDN Analytics");

4.3: Create FCCDNRequest

FCCDNRequest fccdnRequest = new FCCDNRequest();

4.4: Set hashID, title, tags, URL, and other request parameters

fccdnRequest.setHashID("4gpuj6i3znoio7r4");
fccdnRequest.setTitle("Sample Video Title");
fccdnRequest.setTags(tags.toArray(new String[0]));
fccdnRequest.setUrl("https://woj7lng8dg82-hls-live.5centscdn.com/103_push_2351_001/e1f28fb33effa6a5");
fccdnRequest.setShowCV(true);
fccdnRequest.setViewerID(viewerID);
fccdnRequest.setViewID(viewID);
fccdnRequest.setUserAgent(userAgent);
fccdnRequest.setRequestType("");
fccdnRequest.setReferrer("");

Step 5: Configure the initial Activity loading time as value1, which will automatically update as the player progresses.2

fccdnRequest.setValueOne(endTime - startTime);

Step 6: Set up a TextView element to display logs related to API requests, facilitating monitoring and troubleshooting of API interactions.

fccdnRequest.setLogTV(logTV);
fccdnRequest.setLog(true);

Step 7: Set the FCCDNRequest and StyledPlayerView in the FCCDNAnalyticsConfig, linking your video analytics settings with the video player for proper data collection.

fccdnAnalyticsConfig.setFccdnRequest(fccdnRequest);
fccdnAnalyticsConfig.setPlayerView(playerView);

Step 8: Create an “Analytics Collector” responsible for collecting and managing analytics data during video playback.

ExoPlayerCollector exoPlayerCollector = new ExoPlayerCollector(fccdnAnalyticsConfig, this);

Step 9: Complete the setup by initializing the analytics, which prepares your application to collect and process data related to viewer interactions with the video content displayed in the StyledPlayerView.

new InitAnalytics(player, exoPlayerCollector, this, playerView);