Class VimondPlugin
- java.lang.Object
-
- com.castlabs.android.Plugin
-
- com.castlabs.sdk.vimond.VimondPlugin
-
public class VimondPlugin extends Plugin
Vimond Player Session API PluginThis 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 thePlayerController.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 anAnalyticsMetaData
object from a Vimond configurationJSONObject
.static AnalyticsMetaData
createMetadata(JSONObject vimondRequest, String token, AnalyticsMetaData analyticsMetaData)
Populate or create anAnalyticsMetaData
object from a Vimond configurationJSONObject
.String
getId()
void
onRemotePlay(Bundle localConfiguration, JSONObject remoteConfiguration)
-
-
-
Method Detail
-
createMetadata
@Nullable public static AnalyticsMetaData createMetadata(@NonNull JSONObject vimondRequest, @NonNull String token)
Create anAnalyticsMetaData
object from a Vimond configurationJSONObject
.- Parameters:
vimondRequest
- JSONObject with Vimond configurationtoken
- 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 anAnalyticsMetaData
object from a Vimond configurationJSONObject
.- Parameters:
vimondRequest
- JSONObject with Vimond configurationtoken
- The token to use for authenticationanalyticsMetaData
- 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 classPlugin
-
-