public class AliPlayerFactory
extends java.lang.Object
Provides entry points for standard, playlist, and live timeshift players.
| Modifier and Type | Class and Description |
|---|---|
static class |
AliPlayerFactory.BlackType
decoding blacklist type enumeration.
|
static class |
AliPlayerFactory.DeviceInfo
Device information class.
|
static class |
AliPlayerFactory.SupportFeatureType
Device feature support type enumeration.
|
| Constructor and Description |
|---|
AliPlayerFactory() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addBlackDevice(AliPlayerFactory.BlackType blackType,
AliPlayerFactory.DeviceInfo deviceInfo)
Adds a single device to the hardware decoding blacklist.
|
static void |
addBlackList(AliPlayerFactory.BlackType blackType,
java.util.List<AliPlayerFactory.DeviceInfo> deviceInfos)
Adds multiple devices to the hardware decoding blacklist in batch.
|
static AliListPlayer |
createAliListPlayer(android.content.Context context)
Creates a playlist player instance (without trace ID overload).
|
static AliListPlayer |
createAliListPlayer(android.content.Context context,
java.lang.String traceId)
Creates a playlist player instance (with trace ID overload).
|
static AliLiveShiftPlayer |
createAliLiveShiftPlayer(android.content.Context context)
Creates a broadcast timeshift player instance (without trace ID overload).
|
static AliLiveShiftPlayer |
createAliLiveShiftPlayer(android.content.Context context,
java.lang.String traceId)
Creates a broadcast timeshift player instance (with trace ID overload).
|
static AliPlayer |
createAliPlayer(android.content.Context context)
Creates a standard player instance.
|
static AliPlayer |
createAliPlayer(android.content.Context context,
java.lang.String traceId)
Creates a standard player instance with a trace ID for log tracing.
|
static java.lang.String |
getDeviceUUID()
Retrieves the device unique identifier (UUID).
|
static java.lang.String |
getSdkVersion()
Retrieves the player SDK version number.
|
static boolean |
isFeatureSupport(AliPlayerFactory.SupportFeatureType type)
Queries whether the device supports a specified advanced feature.
|
static void |
setConvertURLCallback(IPlayer.ConvertURLCallback callback)
Sets the URL conversion callback.
|
public static AliPlayer createAliPlayer(android.content.Context context)
context - Application contextAliPlayer instancepublic static AliPlayer createAliPlayer(android.content.Context context, java.lang.String traceId)
context - Application contexttraceId - Trace ID; set to "DisableAnalytics" to disable analytics (not recommended)AliPlayer instancepublic static AliListPlayer createAliListPlayer(android.content.Context context)
Playlist players are suitable for scenarios involving continuous playback of multiple media sources, such as short video lists or carousels.
context - Application context used to initialize system services required by the playerAliListPlayer instanceAliListPlayerpublic static AliListPlayer createAliListPlayer(android.content.Context context, java.lang.String traceId)
Playlist players are suitable for scenarios involving continuous playback of multiple media sources.
Note: Setting traceId to "DisableAnalytics" disables log analytics reporting,
which may impair troubleshooting capabilities and is not recommended in production.
context - Application context used to initialize system services required by the playertraceId - Log tracing identifier to correlate logs from the same business scenario;
set to "DisableAnalytics" to disable analytics (not recommended)AliListPlayer instanceAliListPlayerpublic static AliLiveShiftPlayer createAliLiveShiftPlayer(android.content.Context context)
Broadcast timeshift players support operations like rewind, pause, and fast-forward on live streams.
context - Application context used to initialize system services required by the playerAliLiveShiftPlayer instanceAliLiveShiftPlayerpublic static AliLiveShiftPlayer createAliLiveShiftPlayer(android.content.Context context, java.lang.String traceId)
Broadcast timeshift players support operations like rewind, pause, and fast-forward on live streams.
context - Application context used to initialize system services required by the playertraceId - Log tracing identifier to correlate logs from the same business scenarioAliLiveShiftPlayer instanceAliLiveShiftPlayerpublic static java.lang.String getSdkVersion()
public static void addBlackDevice(AliPlayerFactory.BlackType blackType, AliPlayerFactory.DeviceInfo deviceInfo)
If the current device model matches deviceInfo.model and meets API level requirements,
the corresponding hardware decoding feature is disabled.
Note: This method should be called before creating player instances, otherwise it may have no effect.
blackType - Blacklist type, see AliPlayerFactory.BlackTypedeviceInfo - Device information object containing the model to blacklist; ignored if nullAliPlayerFactory.BlackType,
AliPlayerFactory.DeviceInfopublic static void addBlackList(AliPlayerFactory.BlackType blackType, java.util.List<AliPlayerFactory.DeviceInfo> deviceInfos)
Calls addBlackDevice(BlackType, DeviceInfo) for each device info in the list.
blackType - Blacklist type, see AliPlayerFactory.BlackTypedeviceInfos - List of device information objects; ignored if nullAliPlayerFactory.BlackType,
AliPlayerFactory.DeviceInfo,
addBlackDevice(BlackType, DeviceInfo)public static void setConvertURLCallback(IPlayer.ConvertURLCallback callback)
callback - URL conversion callback instance; set to null to unregisterIPlayer.ConvertURLCallbackpublic static java.lang.String getDeviceUUID()
This UUID is randomly generated on the first app launch and remains unchanged thereafter, useful for device-level log tracing.
Note: This UUID is unrelated to Android system IDs and is only valid within the current application.
public static boolean isFeatureSupport(AliPlayerFactory.SupportFeatureType type)
Currently only supports querying AliPlayerFactory.SupportFeatureType.FeatureDolbyAudio.
type - Feature support type, see AliPlayerFactory.SupportFeatureTypetrue if the device supports the feature, false otherwiseAliPlayerFactory.SupportFeatureType