Class InsightUtil

java.lang.Object
com.nagra.otvaa.sdk.insightwrapper.InsightUtil

public class InsightUtil extends Object
  • Field Details

  • Method Details

    • getContent

      public static com.nagra.insight.agent.api.ContentInformation getContent(ContentInfoHolder xContentInfoHolder, WrapperConfig wrapperConfig, Boolean integrationMode) throws RuntimeException
      Converts the content information container into the new agent data structure.
      Parameters:
      xContentInfoHolder - content information definition for the old agent
      wrapperConfig - agent wrapper configuration
      integrationMode - if set to true, it allows non valid operations to be detected during the integration by throwing some runtime exceptions. If set to false or null, then the errors will only be logged.
      Returns:
      ContentInformation content information definition for the new agent
      Throws:
      RuntimeException
    • getUserInfo

      public static com.nagra.insight.agent.api.UserInfo getUserInfo(UserInfoHolder xUserInfoHolder)
      Converts the user information container into the new agent data structure.
      Parameters:
      xUserInfoHolder - user information definition for the old agent
      Returns:
      UserInfo user information definition for the new agent
    • getInsightConfig

      public static com.nagra.insight.agent.InsightConfig getInsightConfig(Context context, String collectorUrl, Integer samplingInterval, Integer reportingPeriod, String appName, String appVersion, String deviceId, String deviceType, String operatorId, boolean integrationMode, String playerName, String playerVersion)

      Gets the InsightAgent configuration.


      This utility method builds the configuration needed by the latest Insight Agent by only specifying the configuration parameters used by the legacy agent. The other InsightAgent parameters will be defined as follows:
       deviceManufacturer =  Build.MANUFACTURER
       deviceModel = Build.MODEL
       osName ="Android"
       osVersion = Build.VERSION.RELEASE
       screenWidth = displayMetrics.widthPixels
       screenHeight = displayMetrics.heightPixels
       screenDensity = displayMetrics.densityDpi
       timezone = TimeZone.getDefault().getID()
       framedropsEnabled = true
      
       where displayMetrics = Resources.getSystem().getDisplayMetrics()
      Parameters:
      context - Player application context
      collectorUrl - The endpoint of the Nagra Insight Collector service
      samplingInterval - Amount of seconds between each metrics sample
      reportingPeriod - Amount of seconds between each report that submits a collection of samples. (The actual reporting time should include a +-10% random jitter)
      appName - The name of the application
      appVersion - The version of the application
      deviceId - Device identifier. If the specified deviceId is null then the final value for the device ID will be set to Settings.Secure.ANDROID_ID.
      deviceType - The type of device (handheld, desktop, stb)
      operatorId - Operator token used to identify the tenants
      integrationMode - if set to true, it allows non valid operations to be detected during the integration by throwing some runtime exceptions. If set to false then the errors will only be logged.
    • reportMediaPlayerError

      public static void reportMediaPlayerError(com.nagra.insight.agent.Agent agent, String errorCode, String errorMessage)
      Notifies the agent of a playback error if the error is detected
      Parameters:
      agent - the Insight agent
      errorCode - error code
      errorMessage - error message
    • isIntegrationVersion

      public static boolean isIntegrationVersion(String sdkVersion)
      Detect if current sdk is integration version
    • setIntegrationMode

      public static com.nagra.insight.agent.InsightConfig setIntegrationMode(com.nagra.insight.agent.InsightConfig insightConfig, boolean enableIntegrationMode)
      Set integration mode in Insight Config
      Parameters:
      insightConfig - the Insight config to set integration mode
      enableIntegrationMode - integration mode
    • setDeviceIdInConfig

      public static com.nagra.insight.agent.InsightConfig setDeviceIdInConfig(Context context, com.nagra.insight.agent.InsightConfig insightConfig)
      Set deviceId in Insight Config
      Parameters:
      context - player application context
      insightConfig - the Insight config to set device ID
    • getContentQuality

      public static com.nagra.insight.agent.api.ContentQuality getContentQuality(int width, int height)