Class Analytics

java.lang.Object
com.brightcove.player.event.AbstractComponent
com.brightcove.player.analytics.Analytics
All Implemented Interfaces:
Component

@Emits(events={"account","analyticsMetricsRequest","didSetAnalyticsBaseParams","error"}) @ListensFor(events={"account","activityStarted","activityStopped","activityDestroyed","adBreakStarted","adBreakCompleted","adProgress","addAnalyticsBaseParams","analyticsCatalogRequest","analyticsCatalogResponse","analyticsVideoEngagement","bufferingCompleted","bufferingStarted","completed","didPause","didPlay","didSeekTo","didSetVideo","error","fragmentStarted","fragmentStopped","fragmentDestroyed","play","progress","setAnalyticsBaseParams","version","videoDurationChanged","videoSizeKnown","willChangeVideo","videoDownloadStarted","videoDownloadCompleted","videoDownloadCancelled","videoDownloadFailed","adViewableImpression","adError","adStarted","adCompleted"}) public class Analytics extends AbstractComponent
  • Field Details

    • TAG

      public static final String TAG
    • destination

      public String destination
      The value that will be passed as the 'destination' parameter for all analytics events. This must be a valid URI.
  • Constructor Details

    • Analytics

      public Analytics(EventEmitter emitter, android.content.Context context)
    • Analytics

      protected Analytics(EventEmitter emitter, android.content.Context context, Class<? extends Component> componentClass)
  • Method Details

    • getSessionKey

      @NonNull public static String getSessionKey()
      Gets the globally unique session key for this application session.
      Returns:
      the unique session key
    • setMediaPlayback

      public Analytics setMediaPlayback(MediaPlayback<?> playback)
    • getAccount

      public String getAccount()
      Returns the global account override.
    • setAccount

      public void setAccount(String account)
      Sets the global account override.
    • setIsPlaybackForegrounded

      public void setIsPlaybackForegrounded(boolean foregrounded)
      Set if the playback is attached to an on-going notification in a foreground service.
      Parameters:
      foregrounded - If the playback is attached to a service.
    • setDestination

      public void setDestination(String destination)
      The destination must be a valid URI.
    • setSource

      public void setSource(String source)
      The source must be a valid URI.
    • setPlayerName

      public void setPlayerName(@NonNull String playerName)
      Set a name to the player
      Parameters:
      playerName - - The value to be set to the player field
    • setPlayerID

      public void setPlayerID(@NonNull String playerID)
      Set an ID to the player
      Parameters:
      playerID - - The value to be set to the player_id field
    • setApplication

      public void setApplication(@NonNull String application)
      Set an ID to the application
      Parameters:
      application - - The value to be set to the application field
    • setVideo

      public void setVideo(Video video)
    • getAnalyticParams

      protected Map<String,String> getAnalyticParams(String eventName, Video video, Map<String,String> eventParams)
    • sendAnalyticsRequest

      protected Map<String,String> sendAnalyticsRequest(Event event, String analyticsEvent, Map<String,String> customParams)
    • getUserAgentDeviceType

      public static String getUserAgentDeviceType()
      Return a static version of the result from the getDeviceType method in this class
      Returns:
      the static version of the device type, to build the SDK User-Agent string
    • getUniqueIdentifierEnabled

      public boolean getUniqueIdentifierEnabled()
      Return whether the client side unique identifier feature is enabled.
    • setUniqueIdentifierEnabled

      public void setUniqueIdentifierEnabled(boolean uniqueIdentifierEnabled)
      Set whether the client side unique identifier feature is enabled. By default, unique user tracking is implemented by the Brightcove Analytics server using the client IP address and user agent, but when the client side unique identifier feature is enabled, the device's android ID is used to uniquely identify the user.
      See Also:
      • Settings.Secure.ANDROID_ID
    • setMediaType

      public void setMediaType(Analytics.MediaType mediaType)
      Set the Analytics.MediaType for the currently playing item.
      Parameters:
      mediaType - - Analytics.MediaType.AUDIO if playing audio only, otherwise Analytics.MediaType.VIDEO.
    • setDeliveryType

      public void setDeliveryType(Analytics.DeliveryType deliveryType)
      Set the Analytics.DeliveryType for the currently playing item.
      Parameters:
      deliveryType - - Analytics.DeliveryType.LIVE if playing live, otherwise Analytics.DeliveryType.ON_DEMAND.
    • copy

      @RestrictTo(LIBRARY) public static Analytics copy(Analytics analytics, EventEmitter emitter, android.content.Context context)
      Creates a new instance with the properties from the provided Analytics.
      Parameters:
      analytics - The analytics used to initialize the properties of the new instance.
      emitter - The event emitter associated with playback.
      context - The application context.
      Returns:
      A new instance of Analytics.