Package com.castlabs.sdk.mux
Class MuxPlugin
java.lang.Object
com.castlabs.android.Plugin
com.castlabs.sdk.mux.MuxPlugin
This plugin integrates MUX Data with the castLabs Player SDK.
You can enable and register the plugin before you initialize the SDK:
public class MyApp extends Application {
@
Override
public void onCreate() {
super.onCreate();
MuxPlugin muxPlugin = new MuxPlugin(MUX_API_KEY);
PlayerSDK.register(muxPlugin);
PlayerSDK.init(getApplicationContext());
}
}
Then, upon playback start, you should inform AnalyticsMetaData
field when
opening
the Controller:
//...
// Create MUX CustomerData, fill in metadata
CustomerVideoData videoData = new CustomerVideoData();
videoData.setVideoTitle("The Lord of the Rings");
videoData.setVideoLanguageCode("en");
//videoData.setVideoProducer(...);
//videoData.setVideoEncodingVariant(...);
// Create MUX PlayerData, fill in metadata
CustomerPlayerData playerData = new CustomerPlayerData();
playerData.setViewerUserId("userId");
//playerData.setExperimentName(...);
// Create AnalyticsMetadata and set it in the Bundle used to open the PlayerController
AnalyticsMetaData analyticsMetaData = MuxPlugin.createMetadata(false, "lotr-1", videoData, playerData);
bundle.put(SdkConsts.INTENT_ANALYTICS_DATA, analyticsMetaData);
//...
playerController.open(bundle)
- Since:
- 4.1.19
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a Mux Plugin with null Environment Key.Create Mux Plugin with the given Environment Key, or null.Create Mux Plugin with the given Environment Key and keepSessionInBackground value. -
Method Summary
Modifier and TypeMethodDescriptionstatic AnalyticsMetaData
createMetadata
(boolean live, String assetId, com.mux.stats.sdk.core.model.CustomerData customerData, com.mux.stats.sdk.core.CustomOptions customOptions, AnalyticsMetaData analyticsMetaData) Return anAnalyticsMetaData
object with the provided Mux Data.static AnalyticsMetaData
createMetadata
(boolean live, String assetId, com.mux.stats.sdk.core.model.CustomerVideoData customerVideoData, com.mux.stats.sdk.core.model.CustomerPlayerData customerPlayerData, com.mux.stats.sdk.core.model.CustomerViewData customerViewData) Deprecated.getId()
Methods inherited from class com.castlabs.android.Plugin
init, onRemotePlay
-
Constructor Details
-
MuxPlugin
public MuxPlugin()Create a Mux Plugin with null Environment Key. -
MuxPlugin
Create Mux Plugin with the given Environment Key, or null. If null is passed, you must inform the Environment Key upon playback start through Mux's PlayerData. Even if an Environment Key is informed here, it may be later overridden on playback start. The plugin is constructed that the session is not kept alive when the app is backgrounded.- Parameters:
environmentKey
- the Environment Key to use, or null.
-
MuxPlugin
Create Mux Plugin with the given Environment Key and keepSessionInBackground value.- Parameters:
environmentKey
- the Environment Key to use, or null.keepSessionInBackground
- the flag which defines whether the session should be kept alive when the app is backgrounded.
-
-
Method Details
-
getId
-
createMetadata
@Deprecated public static AnalyticsMetaData createMetadata(boolean live, @NonNull String assetId, @Nullable com.mux.stats.sdk.core.model.CustomerVideoData customerVideoData, @Nullable com.mux.stats.sdk.core.model.CustomerPlayerData customerPlayerData, @Nullable com.mux.stats.sdk.core.model.CustomerViewData customerViewData) Deprecated.Create anAnalyticsMetaData
object with the provided Mux Data- Parameters:
live
- whether the asset is a live stream or notassetId
- unique asset identifiercustomerVideoData
- instance of Mux'CustomerViewData
customerPlayerData
- instance of Mux'CustomerPlayerData
customerViewData
- instance of Mux'CustomerViewData
- Returns:
- the
AnalyticsMetaData
-
createMetadata
public static AnalyticsMetaData createMetadata(boolean live, @NonNull String assetId, @NonNull com.mux.stats.sdk.core.model.CustomerData customerData, @Nullable com.mux.stats.sdk.core.CustomOptions customOptions, @Nullable AnalyticsMetaData analyticsMetaData) Return anAnalyticsMetaData
object with the provided Mux Data.- Parameters:
live
- whether the asset is a live stream or notassetId
- unique asset identifiercustomerData
- instance of Mux'CustomerData
customOptions
- instance of Mux'CustomOptions
analyticsMetaData
- optional existing instance ofAnalyticsMetaData
to add the Mux Data to. If null is provided a new instance will be created- Returns:
- the
AnalyticsMetaData
instance.
-
createMetadata(boolean, String, CustomerData, CustomOptions, AnalyticsMetaData)
instead