Package com.castlabs.sdk.vimond

## Class VimondPlugin

- java.lang.Object
- - com.castlabs.android.Plugin
  - - com.castlabs.sdk.vimond.VimondPlugin

-     public class VimondPlugin
      extends Plugin

  Vimond Player Session API Plugin

  This plugin integrates Vimond's Player Session API. Such API allows provides some basic analytics capabilities, alongside with an implementation of concurrent stream limiting.

  In order for this plugin to operate, a `JSONObject` must be provided with the player event template. This template should follow Vimond's structure, and is returned by their "play" request.

  The plugin will not override the following values, so it's up to the consumer of this plugin to provide a value for them:

  - originator
  - client.envPlatform
  - client.envVersion
  - viewingSession

  In addition, the an authentication token must also be provided. This token will be used for the authentication header. A new token can be provided to the Plugin at runtime. Check the documentation for `VimondComponent` for more details on how to do this.

  Basic usage of the plugin:

        public class MyApp extends Application {
           @Override
            public void onCreate() {
                super.onCreate();
                // ...
                VimondPlugin vimond = new VimondPlugin();
                PlayerSDK.register(vimond);
                // ...
                PlayerSDK.init(getApplicationContext());
            }
       }

  When starting playback, the template and token must be provided in the `AnalyticsMetaData` class passed to the `PlayerController.open(Bundle)` method:

        bundle.putParcelable(SdkConsts.INTENT_ANALYTICS_DATA,
               VimondPlugin.createMetadata(templateObject, "token"));
        // ...
        playerController.open(bundle);

  Since:
    4.2.34

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `VimondPlugin()` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static AnalyticsMetaData` | `createMetadata​(JSONObject vimondRequest, String token)` | Create an `AnalyticsMetaData` object from a Vimond configuration `JSONObject`.
    `static AnalyticsMetaData` | `createMetadata​(JSONObject vimondRequest, String token, AnalyticsMetaData analyticsMetaData)` | Populate or create an `AnalyticsMetaData` object from a Vimond configuration `JSONObject`.
    `String` | `getId()` |
    `void` | `onRemotePlay​(Bundle localConfiguration, JSONObject remoteConfiguration)` |

    - ### Methods inherited from class com.castlabs.android.Plugin

      `init`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### VimondPlugin

          public VimondPlugin()

  - ### Method Detail

    - #### getId

          @NonNull
          public String getId()

      Specified by:
        `getId` in class `Plugin`

    - #### createMetadata

          @Nullable
          public static AnalyticsMetaData createMetadata​(@NonNull
                                                         JSONObject vimondRequest,
                                                         @NonNull
                                                         String token)

      Create an `AnalyticsMetaData` object from a Vimond configuration `JSONObject`.
      Parameters:
        `vimondRequest` - JSONObject with Vimond configuration
        `token` - The token to use for authentication
      Returns:
        instance of AnalyticsMetaData. Can be null if the request object does not have the expected structure.

    - #### createMetadata

          @Nullable
          public static AnalyticsMetaData createMetadata​(@NonNull
                                                         JSONObject vimondRequest,
                                                         @NonNull
                                                         String token,
                                                         @Nullable
                                                         AnalyticsMetaData analyticsMetaData)

      Populate or create an `AnalyticsMetaData` object from a Vimond configuration `JSONObject`.
      Parameters:
        `vimondRequest` - JSONObject with Vimond configuration
        `token` - The token to use for authentication
        `analyticsMetaData` - AnalyticsMetadata which will be used to save the Vimond config. If null, a new AnalyticsMetadata will be created.
      Returns:
        instance of AnalyticsMetaData. Can be null if the request object does not have the expected structure.

    - #### onRemotePlay

          public void onRemotePlay​(@NonNull
                                   Bundle localConfiguration,
                                   @NonNull
                                   JSONObject remoteConfiguration)

      Overrides:
        `onRemotePlay` in class `Plugin`