public class AliPlayerGlobalSettings
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
AliPlayerGlobalSettings.OnGetUrlHashCallback
Get the hash value of the loaded URL, used as the unique id of the URL.
|
static interface |
AliPlayerGlobalSettings.OnNetworkCallback
A chance for media data downloading from network and modified by app, now only mp4 is supported
|
static class |
AliPlayerGlobalSettings.StreamType
audio stream type
|
Modifier and Type | Field and Description |
---|---|
static int |
ENABLE_H2_MULTIPLEX |
static int |
SET_DNS_PRIORITY_LOCAL_FIRST |
static int |
SET_EXTRA_DATA |
static int |
SET_PRE_CONNECT_DOMAIN |
Constructor and Description |
---|
AliPlayerGlobalSettings() |
Modifier and Type | Method and Description |
---|---|
static void |
clearCaches()
Clear all cache files.
|
static void |
disableCrashUpload(boolean disable) |
static void |
enableBufferToLocalCache(boolean enable) |
static void |
enableEnhancedHttpDns(boolean enable)
enable enhanced httpDNS.
|
static void |
enableHttpDns(boolean enable)
Deprecated.
|
static void |
enableLocalCache(boolean enable,
int maxBufferMemoryKB,
java.lang.String localCacheDir)
Enable local cache.
|
static void |
enableNetworkBalance(boolean enable)
enable Network Balance mechanism for control media loader's scheduling automatically.
|
static void |
forceAudioRendingFormat(boolean force,
java.lang.String format,
int channels,
int sample_rate)
force audio render use the particular format,the value will no effect when the format not supported by device,the out range value will be ignored,and use the default value;
and it will affect the pcm data that from audio rending callback, it only can be reset in the same thread, disabled by default.
|
static void |
loadClass() |
static void |
setAudioStreamType(AliPlayerGlobalSettings.StreamType streamType)
Set audio stream type
|
static void |
setCacheFileClearConfig(long expireMin,
long maxCapacityMB,
long freeStorageMB)
Settings related to automatic cleanup of local cache files
|
static void |
setCacheUrlHashCallback(AliPlayerGlobalSettings.OnGetUrlHashCallback cb)
Sets the hash callback to load the URL.
|
static void |
setDNSResolve(java.lang.String host,
java.lang.String ip)
Set a DNS ip to resolve the host.
|
static void |
setIPResolveType(IPlayer.IPResolveType type)
set ip resolve type
|
static void |
setNetworkCallback(AliPlayerGlobalSettings.OnNetworkCallback cb)
Set the network data callback to listen and change network data(only support mp4).
|
static void |
setOption(int key,
int value)
Set specific option
|
static void |
setOption(int key,
java.lang.String value)
Set specific option
|
static void |
setUseHttp2(boolean use)
Set if use http2.
|
public static final int SET_PRE_CONNECT_DOMAIN
public static final int SET_DNS_PRIORITY_LOCAL_FIRST
public static final int ENABLE_H2_MULTIPLEX
public static final int SET_EXTRA_DATA
public static void loadClass()
public static void setOption(int key, java.lang.String value)
key
- key optionvalue
- value of keypublic static void setOption(int key, int value)
key
- key optionvalue
- value of keypublic static void setDNSResolve(java.lang.String host, java.lang.String ip)
host
- The host. Need to specify the port(http defualt port is 80,https default port is 443). E.g player.alicdn.com:80ip
- The ip address, set as empty string to clear the setting.public static void setUseHttp2(boolean use)
use
- true:use http2.public static void setIPResolveType(IPlayer.IPResolveType type)
type
- See IPlayer.IPResolveType
public static void setAudioStreamType(AliPlayerGlobalSettings.StreamType streamType)
streamType
- see AliPlayerGlobalSettings.StreamTypepublic static void forceAudioRendingFormat(boolean force, java.lang.String format, int channels, int sample_rate)
force
- enable/disableformat
- the pcm format, only support s16 for now, signed integer with 16 bitschannels
- the pcm channels, available range 1~2sample_rate
- set the pcm sample rate, available range 1~48000public static void enableLocalCache(boolean enable, int maxBufferMemoryKB, java.lang.String localCacheDir)
enable
- true: enables the local cache. false: disable. This function is disabled by default.maxBufferMemoryKB
- Set the maximum memory size for a single source. Unit is KBlocalCacheDir
- Directory of files cached locally, absolute pathpublic static void setCacheFileClearConfig(long expireMin, long maxCapacityMB, long freeStorageMB)
expireMin
- How long the cache expires: the unit is minute. The default value is 30 days.maxCapacityMB
- maximum cache capacity: in megabytes. The default value is 20GB. If the total cache size exceeds this size, the cache size is sorted by cacheItem until it is less than or equal to the maximum cache capacity.freeStorageMB
- Minimum free disk capacity: in megabytes (default value: 0). If the current disk capacity is less than this value, the freeStorage will be eliminated one by one until the freeStorage is greater than or equal to this value or all caches are eliminated.public static void clearCaches()
public static void setCacheUrlHashCallback(AliPlayerGlobalSettings.OnGetUrlHashCallback cb)
cb
- the hash callbackpublic static void setNetworkCallback(AliPlayerGlobalSettings.OnNetworkCallback cb)
@Deprecated public static void enableHttpDns(boolean enable)
enable
- public static void enableEnhancedHttpDns(boolean enable)
com.aliyun.dns.DomainProcessor#addEnhancedHttpDnsDomain(String)
, otherwise it will be downgraded to local dns
4.Please ensure that the domain name is added and configured with corresponding functions on the alicdn platform to ensure that online services can be provided.
For configuration methods, please refer to: https://www.alibabacloud.com/product/content-delivery-networkenable
- public static void enableNetworkBalance(boolean enable)
enable
- public static void enableBufferToLocalCache(boolean enable)
enable
- public static void disableCrashUpload(boolean disable)
disable
-