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(...);
CustomerData customerData = new CustomerData();
customerData.setCustomerVideoData(videoData);
customerData.setCustomerPlayerData(playerData);
// Create AnalyticsMetadata and set it in the Bundle used to open the PlayerController
AnalyticsMetaData analyticsMetaData = new MuxPlugin.MetadataBuilder(false, "lotr-1")
.customerData(customerData)
.get();
bundle.put(SdkConsts.INTENT_ANALYTICS_DATA, analyticsMetaData);
//...
playerController.open(bundle)
- Since:
- 4.1.19
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA helper class to buildAnalyticsMetaDataobjects for the Mux plugin. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AnalyticsMetaDatacreateMetadata(boolean live, String assetId, com.mux.stats.sdk.core.model.CustomerData customerData, com.mux.stats.sdk.core.CustomOptions customOptions, AnalyticsMetaData analyticsMetaData) Deprecated.UseMuxPlugin.MetadataBuilderinstead.static AnalyticsMetaDatacreateMetadata(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.UseMuxPlugin.MetadataBuilderinstead.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
Deprecated.Register the plugin withMuxPlugin(String)and configure background retention for each playback withMuxPlugin.MetadataBuilder.keepSessionInBackground(boolean). The value supplied to this constructor remains the fallback for metadata without an explicit retention setting.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.UseMuxPlugin.MetadataBuilderinstead.Create anAnalyticsMetaDataobject with the provided Mux Data- Parameters:
live- whether the asset is a live stream or notassetId- unique asset identifiercustomerVideoData- instance of Mux'CustomerVideoDatacustomerPlayerData- instance of Mux'CustomerPlayerDatacustomerViewData- instance of Mux'CustomerViewData- Returns:
- the
AnalyticsMetaData
-
createMetadata
@Deprecated 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) Deprecated.UseMuxPlugin.MetadataBuilderinstead.Return anAnalyticsMetaDataobject with the provided Mux Data.- Parameters:
live- whether the asset is a live stream or notassetId- unique asset identifiercustomerData- instance of Mux'CustomerDatacustomOptions- instance of Mux'CustomOptionsanalyticsMetaData- optional existing instance ofAnalyticsMetaDatato add the Mux Data to. If null is provided a new instance will be created- Returns:
- the
AnalyticsMetaDatainstance.
-
MuxPlugin(String)and configure background retention for each playback withMuxPlugin.MetadataBuilder.keepSessionInBackground(boolean).