setGlobalCacheFolderPath static method

Future<bool?> setGlobalCacheFolderPath(
  1. String postfixPath
)

Local caching of video files is a highly demanded feature in short video playback scenarios. For ordinary users, when watching a video that has already been viewed, it should not consume data traffic again. @Format support: The SDK supports caching for two common VOD formats: HLS(m3u8) and MP4. @Timing of enabling: The SDK does not enable caching by default, and it is not recommended to enable this feature for scenarios with low user review rates. @Method of enabling: Global effect, enabled with the player. To enable this feature, two parameters need to be configured: the local cache directory and the cache size.

The cache path is set by default to the app sandbox directory, and postfixPath only needs to pass the relative cache directory, without passing the entire absolute path. e.g. postfixPath = 'testCache' On Android platform: the video will be cached to the sdcard/Android/data/your-pkg-name/files/testCache directory. On iOS platform: the video will be cached to the Documents/testCache directory in the sandbox. @param postfixPath Cache directory @return true if the setting is successful, false if the setting fails.

在短视频播放场景中,视频文件的本地缓存是很刚需的一个特性,对于普通用户而言,一个已经看过的视频再次观看时,不应该再消耗一次流量。 @格式支持:SDK 支持 HLS(m3u8) 和 MP4 两种常见点播格式的缓存功能。 @开启时机:SDK 并不默认开启缓存功能,对于用户回看率不高的场景,也并不推荐您开启此功能。 @开启方式:全局生效,在使用播放器开启。开启此功能需要配置两个参数:本地缓存目录及缓存大小。

该缓存路径默认设置到app沙盒目录下,postfixPath只需要传递相对缓存目录即可,不需要传递整个绝对路径。 e.g. postfixPath = 'testCache' Android 平台:视频将会缓存到sdcard的Android/data/your-pkg-name/files/testCache 目录。 iOS 平台:视频将会缓存到沙盒的Documents/testCache 目录。 @param postfixPath 缓存目录 @return true 设置成功 false 设置失败

Implementation

static Future<bool?> setGlobalCacheFolderPath(String postfixPath) async {
  BoolMsg boolMsg = await _playerPluginApi.setGlobalCacheFolderPath(StringMsg()..value = postfixPath);
  return boolMsg.value;
}