提交 311de915 authored 作者: kongdywang's avatar kongdywang

1. maxBufferSize and preloadSize modified from integer to floating-point types,…

1. maxBufferSize and preloadSize modified from integer to floating-point types, and added default values 2. fix download crash when ios' app be killed
上级 01b0aa29
......@@ -283,7 +283,7 @@ public class FTXDownloadManager implements ITXVodDownloadListener, TXFlutterDown
@Override
public IntMsg startPreLoad(@NonNull PreLoadMsg msg) {
String playUrl = msg.getPlayUrl();
int preloadSizeMB = msg.getPreloadSizeMB() != null ? msg.getPreloadSizeMB().intValue() : 0;
float preloadSizeMB = msg.getPreloadSizeMB() != null ? msg.getPreloadSizeMB().floatValue() : 0;
long preferredResolution = msg.getPreferredResolution() != null ? msg.getPreferredResolution() : 0;
final TXVodPreloadManager downloadManager =
TXVodPreloadManager.getInstance(mFlutterPluginBinding.getApplicationContext());
......@@ -320,7 +320,7 @@ public class FTXDownloadManager implements ITXVodDownloadListener, TXFlutterDown
}
final TXVodPreloadManager downloadManager =
TXVodPreloadManager.getInstance(mFlutterPluginBinding.getApplicationContext());
int preloadSizeMB = msg.getPreloadSizeMB() != null ? msg.getPreloadSizeMB().intValue() : 0;
float preloadSizeMB = msg.getPreloadSizeMB() != null ? msg.getPreloadSizeMB().floatValue() : 0;
final long tmpTaskId = msg.getTmpPreloadTaskId() != null ? msg.getTmpPreloadTaskId() : -1;
long preferredResolution = msg.getPreferredResolution() != null ? msg.getPreferredResolution() : 0;
int retTaskID = downloadManager.startPreload(txPlayInfoParams, preloadSizeMB, preferredResolution,
......
......@@ -53,10 +53,10 @@ public class FTXTransformation {
playConfig.setProgressInterval(configPlayerMsg.getProgressInterval().intValue());
}
if (null != configPlayerMsg.getMaxBufferSize()) {
playConfig.setMaxBufferSize(configPlayerMsg.getMaxBufferSize().intValue());
playConfig.setMaxBufferSize(configPlayerMsg.getMaxBufferSize().floatValue());
}
if (null != configPlayerMsg.getMaxPreloadSize()) {
playConfig.setMaxPreloadSize(configPlayerMsg.getMaxPreloadSize().intValue());
playConfig.setMaxPreloadSize(configPlayerMsg.getMaxPreloadSize().floatValue());
}
if (null != configPlayerMsg.getFirstStartPlayBufferTime()) {
playConfig.setFirstStartPlayBufferTime(configPlayerMsg.getFirstStartPlayBufferTime().intValue());
......@@ -126,12 +126,12 @@ public class FTXTransformation {
if (intIsNotEmpty(progressInterval)) {
playConfig.setProgressInterval(progressInterval);
}
Integer maxBufferSize = (Integer) config.get("maxBufferSize");
if (intIsNotEmpty(maxBufferSize)) {
Float maxBufferSize = (Float) config.get("maxBufferSize");
if (floatIsNotEmpty(maxBufferSize)) {
playConfig.setMaxBufferSize(maxBufferSize);
}
Integer maxPreloadSize = (Integer) config.get("maxPreloadSize");
if (intIsNotEmpty(maxPreloadSize)) {
Float maxPreloadSize = (Float) config.get("maxPreloadSize");
if (floatIsNotEmpty(maxPreloadSize)) {
playConfig.setMaxPreloadSize(maxPreloadSize);
}
Integer firstStartPlayBufferTime = (Integer) config.get("firstStartPlayBufferTime");
......@@ -268,6 +268,10 @@ public class FTXTransformation {
return null != value && value > 0;
}
private static boolean floatIsNotEmpty(Float value) {
return null != value && value > 0;
}
private static boolean doubleIsNotEmpty(Double value) {
return null != value && value > 0;
}
......
......@@ -966,23 +966,23 @@ public class FtxMessages {
this.progressInterval = setterArg;
}
private @Nullable Long maxBufferSize;
private @Nullable Double maxBufferSize;
public @Nullable Long getMaxBufferSize() {
public @Nullable Double getMaxBufferSize() {
return maxBufferSize;
}
public void setMaxBufferSize(@Nullable Long setterArg) {
public void setMaxBufferSize(@Nullable Double setterArg) {
this.maxBufferSize = setterArg;
}
private @Nullable Long maxPreloadSize;
private @Nullable Double maxPreloadSize;
public @Nullable Long getMaxPreloadSize() {
public @Nullable Double getMaxPreloadSize() {
return maxPreloadSize;
}
public void setMaxPreloadSize(@Nullable Long setterArg) {
public void setMaxPreloadSize(@Nullable Double setterArg) {
this.maxPreloadSize = setterArg;
}
......@@ -1135,16 +1135,16 @@ public class FtxMessages {
return this;
}
private @Nullable Long maxBufferSize;
private @Nullable Double maxBufferSize;
public @NonNull Builder setMaxBufferSize(@Nullable Long setterArg) {
public @NonNull Builder setMaxBufferSize(@Nullable Double setterArg) {
this.maxBufferSize = setterArg;
return this;
}
private @Nullable Long maxPreloadSize;
private @Nullable Double maxPreloadSize;
public @NonNull Builder setMaxPreloadSize(@Nullable Long setterArg) {
public @NonNull Builder setMaxPreloadSize(@Nullable Double setterArg) {
this.maxPreloadSize = setterArg;
return this;
}
......@@ -1275,9 +1275,9 @@ public class FtxMessages {
Object progressInterval = list.get(10);
pigeonResult.setProgressInterval((progressInterval == null) ? null : ((progressInterval instanceof Integer) ? (Integer) progressInterval : (Long) progressInterval));
Object maxBufferSize = list.get(11);
pigeonResult.setMaxBufferSize((maxBufferSize == null) ? null : ((maxBufferSize instanceof Integer) ? (Integer) maxBufferSize : (Long) maxBufferSize));
pigeonResult.setMaxBufferSize((Double) maxBufferSize);
Object maxPreloadSize = list.get(12);
pigeonResult.setMaxPreloadSize((maxPreloadSize == null) ? null : ((maxPreloadSize instanceof Integer) ? (Integer) maxPreloadSize : (Long) maxPreloadSize));
pigeonResult.setMaxPreloadSize((Double) maxPreloadSize);
Object firstStartPlayBufferTime = list.get(13);
pigeonResult.setFirstStartPlayBufferTime((firstStartPlayBufferTime == null) ? null : ((firstStartPlayBufferTime instanceof Integer) ? (Integer) firstStartPlayBufferTime : (Long) firstStartPlayBufferTime));
Object nextStartPlayBufferTime = list.get(14);
......@@ -2262,13 +2262,13 @@ public class FtxMessages {
this.playUrl = setterArg;
}
private @Nullable Long preloadSizeMB;
private @Nullable Double preloadSizeMB;
public @Nullable Long getPreloadSizeMB() {
public @Nullable Double getPreloadSizeMB() {
return preloadSizeMB;
}
public void setPreloadSizeMB(@Nullable Long setterArg) {
public void setPreloadSizeMB(@Nullable Double setterArg) {
this.preloadSizeMB = setterArg;
}
......@@ -2291,9 +2291,9 @@ public class FtxMessages {
return this;
}
private @Nullable Long preloadSizeMB;
private @Nullable Double preloadSizeMB;
public @NonNull Builder setPreloadSizeMB(@Nullable Long setterArg) {
public @NonNull Builder setPreloadSizeMB(@Nullable Double setterArg) {
this.preloadSizeMB = setterArg;
return this;
}
......@@ -2328,7 +2328,7 @@ public class FtxMessages {
Object playUrl = list.get(0);
pigeonResult.setPlayUrl((String) playUrl);
Object preloadSizeMB = list.get(1);
pigeonResult.setPreloadSizeMB((preloadSizeMB == null) ? null : ((preloadSizeMB instanceof Integer) ? (Integer) preloadSizeMB : (Long) preloadSizeMB));
pigeonResult.setPreloadSizeMB((Double) preloadSizeMB);
Object preferredResolution = list.get(2);
pigeonResult.setPreferredResolution((preferredResolution == null) ? null : ((preferredResolution instanceof Integer) ? (Integer) preferredResolution : (Long) preferredResolution));
return pigeonResult;
......@@ -2377,13 +2377,13 @@ public class FtxMessages {
this.playUrl = setterArg;
}
private @Nullable Long preloadSizeMB;
private @Nullable Double preloadSizeMB;
public @Nullable Long getPreloadSizeMB() {
public @Nullable Double getPreloadSizeMB() {
return preloadSizeMB;
}
public void setPreloadSizeMB(@Nullable Long setterArg) {
public void setPreloadSizeMB(@Nullable Double setterArg) {
this.preloadSizeMB = setterArg;
}
......@@ -2437,9 +2437,9 @@ public class FtxMessages {
return this;
}
private @Nullable Long preloadSizeMB;
private @Nullable Double preloadSizeMB;
public @NonNull Builder setPreloadSizeMB(@Nullable Long setterArg) {
public @NonNull Builder setPreloadSizeMB(@Nullable Double setterArg) {
this.preloadSizeMB = setterArg;
return this;
}
......@@ -2495,7 +2495,7 @@ public class FtxMessages {
Object playUrl = list.get(3);
pigeonResult.setPlayUrl((String) playUrl);
Object preloadSizeMB = list.get(4);
pigeonResult.setPreloadSizeMB((preloadSizeMB == null) ? null : ((preloadSizeMB instanceof Integer) ? (Integer) preloadSizeMB : (Long) preloadSizeMB));
pigeonResult.setPreloadSizeMB((Double) preloadSizeMB);
Object preferredResolution = list.get(5);
pigeonResult.setPreferredResolution((preferredResolution == null) ? null : ((preferredResolution instanceof Integer) ? (Integer) preferredResolution : (Long) preferredResolution));
Object tmpPreloadTaskId = list.get(6);
......
......@@ -1267,27 +1267,27 @@ Future<void> exitPictureInPictureMode() async;
#### 属性配置说明
| 参数名 | 类型 | 描述 |
| ------ | ------ | ------------------ |
| connectRetryCount | int | 播放器重连次数,当SDK与服务器异常断开连接时,SDK会尝试与服务器重连.通过该值设置SDK重连次数 |
| connectRetryInterval | int | 播放器重连间隔,当SDK与服务器异常断开连接时,SDK会尝试与服务器重连.通过该值设置两次重连间隔时间 |
| timeout | int | 播放器连接超时时间 |
| playerType | int | 播放器类型,0 点播,1 直播,2 直播回看 |
| headers | Map | 自定义http headers |
| enableAccurateSeek | bool | 是否精确seek,默认true |
| autoRotate | bool | 播放mp4文件时,若设为true则根据文件中的旋转角度自动旋转。旋转角度可在PLAY_EVT_CHANGE_ROTATION事件中获得。默认true |
| smoothSwitchBitrate | bool | 平滑切换多码率HLS,默认false。设为false时,可提高多码率地址打开速度; 设为true,在IDR对齐时可平滑切换码率 |
| 参数名 | 类型 | 描述 |
| ------ |--------| ------------------ |
| connectRetryCount | int | 播放器重连次数,当SDK与服务器异常断开连接时,SDK会尝试与服务器重连.通过该值设置SDK重连次数 |
| connectRetryInterval | int | 播放器重连间隔,当SDK与服务器异常断开连接时,SDK会尝试与服务器重连.通过该值设置两次重连间隔时间 |
| timeout | int | 播放器连接超时时间 |
| playerType | int | 播放器类型,0 点播,1 直播,2 直播回看 |
| headers | Map | 自定义http headers |
| enableAccurateSeek | bool | 是否精确seek,默认true |
| autoRotate | bool | 播放mp4文件时,若设为true则根据文件中的旋转角度自动旋转。旋转角度可在PLAY_EVT_CHANGE_ROTATION事件中获得。默认true |
| smoothSwitchBitrate | bool | 平滑切换多码率HLS,默认false。设为false时,可提高多码率地址打开速度; 设为true,在IDR对齐时可平滑切换码率 |
| cacheMp4ExtName | String | 缓存mp4文件扩展名,默认mp4 |
| progressInterval | int | 设置进度回调间隔,若不设置,SDK默认间隔0.5秒回调一次,单位毫秒 |
| maxBufferSize | int | 最大播放缓冲大小,单位 MB。此设置会影响playableDuration,设置越大,提前缓存的越多|
| maxPreloadSize | int | 预加载最大缓冲大小,单位:MB|
| firstStartPlayBufferTime | int | 首缓需要加载的数据时长,单位ms,默认值为100ms|
| nextStartPlayBufferTime | int | 缓冲时(缓冲数据不够引起的二次缓冲,或者seek引起的拖动缓冲)最少要缓存多长的数据才能结束缓冲,单位ms,默认值为250ms|
| progressInterval | int | 设置进度回调间隔,若不设置,SDK默认间隔0.5秒回调一次,单位毫秒 |
| maxBufferSize | double | 最大播放缓冲大小,单位 MB。此设置会影响playableDuration,设置越大,提前缓存的越多|
| maxPreloadSize | double | 预加载最大缓冲大小,单位:MB|
| firstStartPlayBufferTime | int | 首缓需要加载的数据时长,单位ms,默认值为100ms|
| nextStartPlayBufferTime | int | 缓冲时(缓冲数据不够引起的二次缓冲,或者seek引起的拖动缓冲)最少要缓存多长的数据才能结束缓冲,单位ms,默认值为250ms|
| overlayKey | String | HLS安全加固加解密key|
| overlayIv | String | HLS安全加固加解密Iv|
| extInfoMap | Map | 一些不必周知的特殊配置|
| enableRenderProcess | bool | 是否允许加载后渲染后处理服务,默认开启,开启后超分插件如果存在,默认加载|
| preferredResolution | int | 优先播放的分辨率,preferredResolution = width * height|
| extInfoMap | Map | 一些不必周知的特殊配置|
| enableRenderProcess | bool | 是否允许加载后渲染后处理服务,默认开启,开启后超分插件如果存在,默认加载|
| preferredResolution | int | 优先播放的分辨率,preferredResolution = width * height|
## TXLivePlayerController类
......@@ -1696,7 +1696,7 @@ Future<int> switchStream(String url) async;
```dart
Future<int> startPreLoad(
final String playUrl,
final int preloadSizeMB,
final double preloadSizeMB,
final int preferredResolution, {
FTXPredownlodOnCompleteListener? onCompleteListener,
FTXPredownlodOnErrorListener? onErrorListener,
......@@ -1705,7 +1705,7 @@ FTXPredownlodOnCompleteListener? onCompleteListener,
```dart
Future<void> startPreload(TXPlayInfoParams txPlayInfoParams,
final int preloadSizeMB,
final double preloadSizeMB,
final int preferredResolution, {
FTXPredownlodOnCompleteListener? onCompleteListener,
FTXPredownlodOnErrorListener? onErrorListener,
......@@ -1715,13 +1715,13 @@ FTXPredownlodOnCompleteListener? onCompleteListener,
**参数说明**
| 参数名 | 类型 | 描述 |
| ------ | ------ | ------------------ |
| playUrl | String | 要预下载的url|
| preloadSizeMB | int | 预下载的大小(单位:MB)|
| preferredResolution | int | 期望分辨率,值为高x宽。可参考如720*1080。不支持多分辨率或不需指定时,传-1|
| 参数名 | 类型 | 描述 |
| ------ |----------------------------------| ------------------ |
| playUrl | String | 要预下载的url|
| preloadSizeMB | double | 预下载的大小(单位:MB)|
| preferredResolution | int | 期望分辨率,值为高x宽。可参考如720*1080。不支持多分辨率或不需指定时,传-1|
| onCompleteListener | FTXPredownlodOnCompleteListener? | 预下载成功回调,全局|
| onErrorListener | FTXPredownlodOnErrorListener | 预下载失败回调,全局|
| onErrorListener | FTXPredownlodOnErrorListener | 预下载失败回调,全局|
TXPlayInfoParams:
......
......@@ -381,27 +381,27 @@ _controller.setPlayConfig(config);
**Parameter description**
| Parameter | Type | Description |
| ------ | ------ | ------------------ |
| connectRetryCount | int | Number of player reconnections. If the SDK is disconnected from the server due to an exception, the SDK will attempt to reconnect to the server |
| connectRetryInterval | int | Interval between two player reconnections. If the SDK is disconnected from the server due to an exception, the SDK will attempt to reconnect to the server |
| timeout | int | Player connection timeout period |
| playerType | int | Player type. Valid values: 0: VOD; 1: live streaming; 2: live stream replay |
| headers | Map | Custom HTTP headers |
| enableAccurateSeek | bool | Whether to enable accurate seek. Default value: true |
| autoRotate | bool | If it is set to `true`, the MP4 file will be automatically rotated according to the rotation angle set in the file, which can be obtained from the `PLAY_EVT_CHANGE_ROTATION` event. Default value: true |
| smoothSwitchBitrate | bool | Whether to enable smooth multi-bitrate HLS stream switch. If it is set to `false` (default), multi-bitrate URLs are opened faster. If it is set to `true`, the bitrate can be switched smoothly when IDR frames are aligned |
| Parameter | Type | Description |
| ------ |--------| ------------------ |
| connectRetryCount | int | Number of player reconnections. If the SDK is disconnected from the server due to an exception, the SDK will attempt to reconnect to the server |
| connectRetryInterval | int | Interval between two player reconnections. If the SDK is disconnected from the server due to an exception, the SDK will attempt to reconnect to the server |
| timeout | int | Player connection timeout period |
| playerType | int | Player type. Valid values: 0: VOD; 1: live streaming; 2: live stream replay |
| headers | Map | Custom HTTP headers |
| enableAccurateSeek | bool | Whether to enable accurate seek. Default value: true |
| autoRotate | bool | If it is set to `true`, the MP4 file will be automatically rotated according to the rotation angle set in the file, which can be obtained from the `PLAY_EVT_CHANGE_ROTATION` event. Default value: true |
| smoothSwitchBitrate | bool | Whether to enable smooth multi-bitrate HLS stream switch. If it is set to `false` (default), multi-bitrate URLs are opened faster. If it is set to `true`, the bitrate can be switched smoothly when IDR frames are aligned |
| cacheMp4ExtName | String | Cached MP4 filename extension. Default value: mp4 |
| progressInterval | int | Progress callback interval in ms. If it is not set, the SDK will call back the progress once every 0.5 seconds |
| maxBufferSize | int | Maximum size of playback buffer in MB. The setting will affect `playableDuration`. The greater the value, the more the data that is buffered in advance |
| maxPreloadSize | int | Maximum preload buffer size in MB |
| firstStartPlayBufferTime | int | Duration of the video data that needs to be loaded during the first buffering in ms. Default value: 100 ms |
| nextStartPlayBufferTime | int | Minimum buffered data size to stop buffering (secondary buffering for insufficient buffered data or progress bar drag buffering caused by `seek`) in ms. Default value: 250 ms |
| progressInterval | int | Progress callback interval in ms. If it is not set, the SDK will call back the progress once every 0.5 seconds |
| maxBufferSize | double | Maximum size of playback buffer in MB. The setting will affect `playableDuration`. The greater the value, the more the data that is buffered in advance |
| maxPreloadSize | double | Maximum preload buffer size in MB |
| firstStartPlayBufferTime | int | Duration of the video data that needs to be loaded during the first buffering in ms. Default value: 100 ms |
| nextStartPlayBufferTime | int | Minimum buffered data size to stop buffering (secondary buffering for insufficient buffered data or progress bar drag buffering caused by `seek`) in ms. Default value: 250 ms |
| overlayKey | String | HLS security hardening encryption and decryption key |
| overlayIv | String | HLS security hardening encryption and decryption IV |
| extInfoMap | Map | Some special configuration items |
| enableRenderProcess | bool | Whether to allow the postrendering and postproduction feature, which is enabled by default. If the super-resolution plugin exists after it is enabled, the plugin will be loaded by default |
| preferredResolution | int | Resolution of the video used for playback preferably. `preferredResolution` = `width` * `height` |
| extInfoMap | Map | Some special configuration items |
| enableRenderProcess | bool | Whether to allow the postrendering and postproduction feature, which is enabled by default. If the super-resolution plugin exists after it is enabled, the plugin will be loaded by default |
| preferredResolution | int | Resolution of the video used for playback preferably. `preferredResolution` = `width` * `height` |
#### Enabling/Disabling hardware decoding
......
......@@ -398,27 +398,27 @@ _controller.setPlayConfig(config);
**参数说明**
| 参数名 | 类型 | 描述 |
| ------ | ------ | ------------------ |
| connectRetryCount | int | 播放器重连次数,当SDK与服务器异常断开连接时,SDK会尝试与服务器重连.通过该值设置SDK重连次数 |
| connectRetryInterval | int | 播放器重连间隔,当SDK与服务器异常断开连接时,SDK会尝试与服务器重连.通过该值设置两次重连间隔时间 |
| timeout | int | 播放器连接超时时间 |
| playerType | int | 播放器类型,0 点播,1 直播,2 直播回看 |
| headers | Map | 自定义http headers |
| enableAccurateSeek | bool | 是否精确seek,默认true |
| autoRotate | bool | 播放mp4文件时,若设为true则根据文件中的旋转角度自动旋转。旋转角度可在PLAY_EVT_CHANGE_ROTATION事件中获得。默认true |
| smoothSwitchBitrate | bool | 平滑切换多码率HLS,默认false。设为false时,可提高多码率地址打开速度; 设为true,在IDR对齐时可平滑切换码率 |
| 参数名 | 类型 | 描述 |
| ------ |--------| ------------------ |
| connectRetryCount | int | 播放器重连次数,当SDK与服务器异常断开连接时,SDK会尝试与服务器重连.通过该值设置SDK重连次数 |
| connectRetryInterval | int | 播放器重连间隔,当SDK与服务器异常断开连接时,SDK会尝试与服务器重连.通过该值设置两次重连间隔时间 |
| timeout | int | 播放器连接超时时间 |
| playerType | int | 播放器类型,0 点播,1 直播,2 直播回看 |
| headers | Map | 自定义http headers |
| enableAccurateSeek | bool | 是否精确seek,默认true |
| autoRotate | bool | 播放mp4文件时,若设为true则根据文件中的旋转角度自动旋转。旋转角度可在PLAY_EVT_CHANGE_ROTATION事件中获得。默认true |
| smoothSwitchBitrate | bool | 平滑切换多码率HLS,默认false。设为false时,可提高多码率地址打开速度; 设为true,在IDR对齐时可平滑切换码率 |
| cacheMp4ExtName | String | 缓存mp4文件扩展名,默认mp4 |
| progressInterval | int | 设置进度回调间隔,若不设置,SDK默认间隔0.5秒回调一次,单位毫秒 |
| maxBufferSize | int | 最大播放缓冲大小,单位 MB。此设置会影响playableDuration,设置越大,提前缓存的越多|
| maxPreloadSize | int | 预加载最大缓冲大小,单位:MB|
| firstStartPlayBufferTime | int | 首缓需要加载的数据时长,单位ms,默认值为100ms|
| nextStartPlayBufferTime | int | 缓冲时(缓冲数据不够引起的二次缓冲,或者seek引起的拖动缓冲)最少要缓存多长的数据才能结束缓冲,单位ms,默认值为250ms|
| progressInterval | int | 设置进度回调间隔,若不设置,SDK默认间隔0.5秒回调一次,单位毫秒 |
| maxBufferSize | double | 最大播放缓冲大小,单位 MB。此设置会影响playableDuration,设置越大,提前缓存的越多|
| maxPreloadSize | double | 预加载最大缓冲大小,单位:MB|
| firstStartPlayBufferTime | int | 首缓需要加载的数据时长,单位ms,默认值为100ms|
| nextStartPlayBufferTime | int | 缓冲时(缓冲数据不够引起的二次缓冲,或者seek引起的拖动缓冲)最少要缓存多长的数据才能结束缓冲,单位ms,默认值为250ms|
| overlayKey | String | HLS安全加固加解密key|
| overlayIv | String | HLS安全加固加解密Iv|
| extInfoMap | Map | 一些不必周知的特殊配置|
| enableRenderProcess | bool | 是否允许加载后渲染后处理服务,默认开启,开启后超分插件如果存在,默认加载|
| preferredResolution | int | 优先播放的分辨率,preferredResolution = width * height|
| extInfoMap | Map | 一些不必周知的特殊配置|
| enableRenderProcess | bool | 是否允许加载后渲染后处理服务,默认开启,开启后超分插件如果存在,默认加载|
| preferredResolution | int | 优先播放的分辨率,preferredResolution = width * height|
### 11、开关硬解
......
......@@ -320,7 +320,7 @@
}
- (nullable IntMsg *)startPreLoadMsg:(nonnull PreLoadMsg *)msg error:(FlutterError * _Nullable __autoreleasing * _Nonnull)error {
int preloadSizeMB = [msg.preloadSizeMB intValue];
float preloadSizeMB = [msg.preloadSizeMB floatValue];
int preferredResolution = [msg.preferredResolution intValue];
int taskID = [[TXVodPreloadManager sharedManager] startPreload:msg.playUrl
preloadSize:preloadSizeMB
......@@ -341,7 +341,7 @@
- (void)startPreLoadByParamsMsg:(PreLoadInfoMsg *)msg error:(FlutterError * _Nullable __autoreleasing *)error {
dispatch_async(self.mPreloadQueue, ^{
BOOL isUrlPreload = msg.playUrl != nil && [msg.playUrl isKindOfClass:[NSString class]] && msg.playUrl.length > 0;
int preloadSizeMB = [msg.preloadSizeMB intValue];
float preloadSizeMB = [msg.preloadSizeMB floatValue];
int preferredResolution = [msg.preferredResolution intValue];
long tmpTaskId = [msg.tmpPreloadTaskId longValue];
NSString *fileId = (msg.fileId != nil && [msg.fileId isKindOfClass:[NSString class]]) ? msg.fileId : @"";
......
......@@ -14,8 +14,8 @@
config.enableAccurateSeek = msg.enableAccurateSeek.boolValue;
config.autoRotate = msg.autoRotate.boolValue;
config.smoothSwitchBitrate = msg.smoothSwitchBitrate.boolValue;
config.maxBufferSize = msg.maxBufferSize.intValue;
config.maxPreloadSize = msg.maxPreloadSize.intValue;
config.maxBufferSize = msg.maxBufferSize.floatValue;
config.maxPreloadSize = msg.maxPreloadSize.floatValue;
config.firstStartPlayBufferTime = msg.firstStartPlayBufferTime.intValue;
config.nextStartPlayBufferTime = msg.nextStartPlayBufferTime.intValue;
config.enableRenderProcess = msg.enableRenderProcess.boolValue;
......
......@@ -138,6 +138,9 @@ SuperPlayerPlugin* instance;
[player notifyAppTerminate:application];
}
}
if (nil != _fTXDownloadManager) {
[_fTXDownloadManager destroy];
}
}
#pragma mark - FlutterStreamHandler
......
// Copyright (c) 2022 Tencent. All rights reserved.
\ No newline at end of file
Copyright (c) 2022 Tencent. All rights reserved.
\ No newline at end of file
......@@ -110,10 +110,10 @@ class FTXVodPlayConfigPlayerMsg {
int? progressInterval;
// 最大播放缓冲大小,单位 MB。此设置会影响playableDuration,设置越大,提前缓存的越多
int? maxBufferSize;
double? maxBufferSize;
// 预加载最大缓冲大小,单位:MB
int? maxPreloadSize;
double? maxPreloadSize;
// 首缓需要加载的数据时长,单位ms,默认值为100ms
int? firstStartPlayBufferTime;
......@@ -263,7 +263,7 @@ class DoubleMsg {
class PreLoadMsg {
String? playUrl;
int? preloadSizeMB;
double? preloadSizeMB;
int? preferredResolution;
}
......@@ -272,7 +272,7 @@ class PreLoadInfoMsg {
String? fileId;
String? pSign;
String? playUrl;
int? preloadSizeMB;
double? preloadSizeMB;
int? preferredResolution;
int? tmpPreloadTaskId;
}
......
......@@ -351,9 +351,9 @@ class FTXVodPlayConfigPlayerMsg {
int? progressInterval;
int? maxBufferSize;
double? maxBufferSize;
int? maxPreloadSize;
double? maxPreloadSize;
int? firstStartPlayBufferTime;
......@@ -408,8 +408,8 @@ class FTXVodPlayConfigPlayerMsg {
smoothSwitchBitrate: result[8] as bool?,
cacheMp4ExtName: result[9] as String?,
progressInterval: result[10] as int?,
maxBufferSize: result[11] as int?,
maxPreloadSize: result[12] as int?,
maxBufferSize: result[11] as double?,
maxPreloadSize: result[12] as double?,
firstStartPlayBufferTime: result[13] as int?,
nextStartPlayBufferTime: result[14] as int?,
overlayKey: result[15] as String?,
......@@ -768,7 +768,7 @@ class PreLoadMsg {
String? playUrl;
int? preloadSizeMB;
double? preloadSizeMB;
int? preferredResolution;
......@@ -784,7 +784,7 @@ class PreLoadMsg {
result as List<Object?>;
return PreLoadMsg(
playUrl: result[0] as String?,
preloadSizeMB: result[1] as int?,
preloadSizeMB: result[1] as double?,
preferredResolution: result[2] as int?,
);
}
......@@ -809,7 +809,7 @@ class PreLoadInfoMsg {
String? playUrl;
int? preloadSizeMB;
double? preloadSizeMB;
int? preferredResolution;
......@@ -834,7 +834,7 @@ class PreLoadInfoMsg {
fileId: result[1] as String?,
pSign: result[2] as String?,
playUrl: result[3] as String?,
preloadSizeMB: result[4] as int?,
preloadSizeMB: result[4] as double?,
preferredResolution: result[5] as int?,
tmpPreloadTaskId: result[6] as int?,
);
......
......@@ -55,7 +55,7 @@ class TXVodDownloadController {
/// 返回值:任务ID,可用这个任务ID停止预下载 [stopPreload]
Future<int> startPreLoad(
final String playUrl,
final int preloadSizeMB,
final double preloadSizeMB,
final int preferredResolution, {
FTXPredownlodOnCompleteListener? onCompleteListener,
FTXPredownlodOnErrorListener? onErrorListener,
......@@ -75,7 +75,7 @@ class TXVodDownloadController {
Future<void> startPreload(
TXPlayInfoParams txPlayInfoParams,
final int preloadSizeMB,
final double preloadSizeMB,
final int preferredResolution, {
FTXPredownlodOnCompleteListener? onCompleteListener,
FTXPredownlodOnErrorListener? onErrorListener,
......
......@@ -51,11 +51,11 @@ class FTXVodPlayConfig {
// Maximum playback buffer size, in MB. This setting will affect playableDuration.
// The larger the setting, the more data will be cached in advance.
// 最大播放缓冲大小,单位 MB。此设置会影响playableDuration,设置越大,提前缓存的越多
int maxBufferSize = 0;
double maxBufferSize = 10;
// Maximum preloading buffer size, in MB.
// 预加载最大缓冲大小,单位:MB
int maxPreloadSize = 0;
double maxPreloadSize = 1;
// Duration of data to be loaded for the first buffering, in milliseconds. The default value is 100ms.
// 首缓需要加载的数据时长,单位ms,默认值为100ms
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论