Class ConvivaAnalyticsSession

  • All Implemented Interfaces:
    AnalyticsSession, PlayerControllerPlugin.Component

    public class ConvivaAnalyticsSession
    extends Object
    implements AnalyticsSession

    This class allows to get ConvivaVideoAnalytics API access. You can get the instance with the getVideoAnalytics() method.

    To get the instance of this class use PlayerController.getComponent(Class) as follows:

    
     ConvivaAnalyticsSession convivaAnalyticsSession = playerView.getPlayerController().getComponent(ConvivaAnalyticsSession.class);
     

    To send a custom Conviva event do the following:

    
     if (convivaAnalyticsSession != null) {
         // Fill custom map
         HashMap<String, Object> customData = new HashMap<>();
         customData.put("now", Long.toString(System.currentTimeMillis()));
         customData.put("fizz", "buzz");
    
         String eventType = "customEvent";
         ConvivaVideoAnalytics videoAnalytics = convivaAnalyticsSession.getVideoAnalytics();
         // Send event
         if (videoAnalytics != null) {
           convivaAnalyticsSession.getVideoAnalytics().reportPlaybackEvent(eventType, customData);
         }
    }