com.aliyun.player

## 类 AliPlayerGlobalSettings

- java.lang.Object
- - com.aliyun.player.AliPlayerGlobalSettings

-     public class AliPlayerGlobalSettings
      extends java.lang.Object

- - ### 嵌套类概要

    嵌套类
    限定符和类型 | 类和说明
    --- | ---
    `static interface` | `AliPlayerGlobalSettings.OnGetUrlHashCallback` Get the hash value of the loaded URL, used as the unique id of the URL.
    `static class` | `AliPlayerGlobalSettings.StreamType` audio stream type

  - ### 构造器概要

    构造器
    构造器和说明
    `AliPlayerGlobalSettings()`

  - ### 方法概要

    所有方法 静态方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `static void` | `clearCaches()` Clear all cache files.
    `static void` | `enableBufferToLocalCache(boolean enable)`
    `static void` | `enableHttpDns(boolean enable)` enable httpDNS.
    `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` | `setUseHttp2(boolean use)` Set if use http2.

    - ### 从类继承的方法 java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 构造器详细资料

    - #### AliPlayerGlobalSettings

          public AliPlayerGlobalSettings()

  - ### 方法详细资料

    - #### loadClass

          public static void loadClass()

    - #### setDNSResolve

          public static void setDNSResolve(java.lang.String host,
                                           java.lang.String ip)

      Set a DNS ip to resolve the host.
      参数:
        `host` - The host. Need to specify the port(http defualt port is 80，https default port is 443). E.g player.alicdn.com:80
        `ip` - The ip address, set as empty string to clear the setting.

    - #### setUseHttp2

          public static void setUseHttp2(boolean use)

      Set if use http2. Default if false.
      参数:
        `use` - true：use http2.

    - #### setIPResolveType

          public static void setIPResolveType(IPlayer.IPResolveType type)

      set ip resolve type
      参数:
        `type` - See `IPlayer.IPResolveType`

    - #### setAudioStreamType

          public static void setAudioStreamType(AliPlayerGlobalSettings.StreamType streamType)

      Set audio stream type
      参数:
        `streamType` - see AliPlayerGlobalSettings.StreamType

    - #### forceAudioRendingFormat

          public 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.
      参数:
        `force` - enable/disable
        `format` - the pcm format, only support s16 for now, signed integer with 16 bits
        `channels` - the pcm channels， available range 1～2
        `sample_rate` - set the pcm sample rate， available range 1～48000

    - #### enableLocalCache

          public static void enableLocalCache(boolean enable,
                                              int maxBufferMemoryKB,
                                              java.lang.String localCacheDir)

      Enable local cache. When enabled, it will be cached in local files.
      参数:
        `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 KB
        `localCacheDir` - Directory of files cached locally, absolute path

    - #### setCacheFileClearConfig

          public static void setCacheFileClearConfig(long expireMin,
                                                     long maxCapacityMB,
                                                     long freeStorageMB)

      Settings related to automatic cleanup of local cache files
      参数:
        `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.

    - #### clearCaches

          public static void clearCaches()

      Clear all cache files.

    - #### setCacheUrlHashCallback

          public static void setCacheUrlHashCallback(AliPlayerGlobalSettings.OnGetUrlHashCallback cb)

      Sets the hash callback to load the URL. If this parameter is not set, the SDK uses md5 algorithm.
      参数:
        `cb` - the hash callback

    - #### enableHttpDns

          public static void enableHttpDns(boolean enable)

      enable httpDNS. Default is disabled.
      参数:
        `enable` -

    - #### enableNetworkBalance

          public static void enableNetworkBalance(boolean enable)

      enable Network Balance mechanism for control media loader's scheduling automatically. Default is enabled.
      参数:
        `enable` -

    - #### enableBufferToLocalCache

          public static void enableBufferToLocalCache(boolean enable)

      参数:
        `enable` -