提交 620a8cdc 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
上级 f04a485e
...@@ -283,7 +283,7 @@ public class FTXDownloadManager implements ITXVodDownloadListener, TXFlutterDown ...@@ -283,7 +283,7 @@ public class FTXDownloadManager implements ITXVodDownloadListener, TXFlutterDown
@Override @Override
public IntMsg startPreLoad(@NonNull PreLoadMsg msg) { public IntMsg startPreLoad(@NonNull PreLoadMsg msg) {
String playUrl = msg.getPlayUrl(); 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; long preferredResolution = msg.getPreferredResolution() != null ? msg.getPreferredResolution() : 0;
final TXVodPreloadManager downloadManager = final TXVodPreloadManager downloadManager =
TXVodPreloadManager.getInstance(mFlutterPluginBinding.getApplicationContext()); TXVodPreloadManager.getInstance(mFlutterPluginBinding.getApplicationContext());
...@@ -320,7 +320,7 @@ public class FTXDownloadManager implements ITXVodDownloadListener, TXFlutterDown ...@@ -320,7 +320,7 @@ public class FTXDownloadManager implements ITXVodDownloadListener, TXFlutterDown
} }
final TXVodPreloadManager downloadManager = final TXVodPreloadManager downloadManager =
TXVodPreloadManager.getInstance(mFlutterPluginBinding.getApplicationContext()); 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; final long tmpTaskId = msg.getTmpPreloadTaskId() != null ? msg.getTmpPreloadTaskId() : -1;
long preferredResolution = msg.getPreferredResolution() != null ? msg.getPreferredResolution() : 0; long preferredResolution = msg.getPreferredResolution() != null ? msg.getPreferredResolution() : 0;
int retTaskID = downloadManager.startPreload(txPlayInfoParams, preloadSizeMB, preferredResolution, int retTaskID = downloadManager.startPreload(txPlayInfoParams, preloadSizeMB, preferredResolution,
......
...@@ -53,10 +53,10 @@ public class FTXTransformation { ...@@ -53,10 +53,10 @@ public class FTXTransformation {
playConfig.setProgressInterval(configPlayerMsg.getProgressInterval().intValue()); playConfig.setProgressInterval(configPlayerMsg.getProgressInterval().intValue());
} }
if (null != configPlayerMsg.getMaxBufferSize()) { if (null != configPlayerMsg.getMaxBufferSize()) {
playConfig.setMaxBufferSize(configPlayerMsg.getMaxBufferSize().intValue()); playConfig.setMaxBufferSize(configPlayerMsg.getMaxBufferSize().floatValue());
} }
if (null != configPlayerMsg.getMaxPreloadSize()) { if (null != configPlayerMsg.getMaxPreloadSize()) {
playConfig.setMaxPreloadSize(configPlayerMsg.getMaxPreloadSize().intValue()); playConfig.setMaxPreloadSize(configPlayerMsg.getMaxPreloadSize().floatValue());
} }
if (null != configPlayerMsg.getFirstStartPlayBufferTime()) { if (null != configPlayerMsg.getFirstStartPlayBufferTime()) {
playConfig.setFirstStartPlayBufferTime(configPlayerMsg.getFirstStartPlayBufferTime().intValue()); playConfig.setFirstStartPlayBufferTime(configPlayerMsg.getFirstStartPlayBufferTime().intValue());
...@@ -126,12 +126,12 @@ public class FTXTransformation { ...@@ -126,12 +126,12 @@ public class FTXTransformation {
if (intIsNotEmpty(progressInterval)) { if (intIsNotEmpty(progressInterval)) {
playConfig.setProgressInterval(progressInterval); playConfig.setProgressInterval(progressInterval);
} }
Integer maxBufferSize = (Integer) config.get("maxBufferSize"); Float maxBufferSize = (Float) config.get("maxBufferSize");
if (intIsNotEmpty(maxBufferSize)) { if (floatIsNotEmpty(maxBufferSize)) {
playConfig.setMaxBufferSize(maxBufferSize); playConfig.setMaxBufferSize(maxBufferSize);
} }
Integer maxPreloadSize = (Integer) config.get("maxPreloadSize"); Float maxPreloadSize = (Float) config.get("maxPreloadSize");
if (intIsNotEmpty(maxPreloadSize)) { if (floatIsNotEmpty(maxPreloadSize)) {
playConfig.setMaxPreloadSize(maxPreloadSize); playConfig.setMaxPreloadSize(maxPreloadSize);
} }
Integer firstStartPlayBufferTime = (Integer) config.get("firstStartPlayBufferTime"); Integer firstStartPlayBufferTime = (Integer) config.get("firstStartPlayBufferTime");
...@@ -268,6 +268,10 @@ public class FTXTransformation { ...@@ -268,6 +268,10 @@ public class FTXTransformation {
return null != value && value > 0; return null != value && value > 0;
} }
private static boolean floatIsNotEmpty(Float value) {
return null != value && value > 0;
}
private static boolean doubleIsNotEmpty(Double value) { private static boolean doubleIsNotEmpty(Double value) {
return null != value && value > 0; return null != value && value > 0;
} }
......
...@@ -966,23 +966,23 @@ public class FtxMessages { ...@@ -966,23 +966,23 @@ public class FtxMessages {
this.progressInterval = setterArg; this.progressInterval = setterArg;
} }
private @Nullable Long maxBufferSize; private @Nullable Double maxBufferSize;
public @Nullable Long getMaxBufferSize() { public @Nullable Double getMaxBufferSize() {
return maxBufferSize; return maxBufferSize;
} }
public void setMaxBufferSize(@Nullable Long setterArg) { public void setMaxBufferSize(@Nullable Double setterArg) {
this.maxBufferSize = setterArg; this.maxBufferSize = setterArg;
} }
private @Nullable Long maxPreloadSize; private @Nullable Double maxPreloadSize;
public @Nullable Long getMaxPreloadSize() { public @Nullable Double getMaxPreloadSize() {
return maxPreloadSize; return maxPreloadSize;
} }
public void setMaxPreloadSize(@Nullable Long setterArg) { public void setMaxPreloadSize(@Nullable Double setterArg) {
this.maxPreloadSize = setterArg; this.maxPreloadSize = setterArg;
} }
...@@ -1135,16 +1135,16 @@ public class FtxMessages { ...@@ -1135,16 +1135,16 @@ public class FtxMessages {
return this; 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; this.maxBufferSize = setterArg;
return this; 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; this.maxPreloadSize = setterArg;
return this; return this;
} }
...@@ -1275,9 +1275,9 @@ public class FtxMessages { ...@@ -1275,9 +1275,9 @@ public class FtxMessages {
Object progressInterval = list.get(10); Object progressInterval = list.get(10);
pigeonResult.setProgressInterval((progressInterval == null) ? null : ((progressInterval instanceof Integer) ? (Integer) progressInterval : (Long) progressInterval)); pigeonResult.setProgressInterval((progressInterval == null) ? null : ((progressInterval instanceof Integer) ? (Integer) progressInterval : (Long) progressInterval));
Object maxBufferSize = list.get(11); 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); 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); Object firstStartPlayBufferTime = list.get(13);
pigeonResult.setFirstStartPlayBufferTime((firstStartPlayBufferTime == null) ? null : ((firstStartPlayBufferTime instanceof Integer) ? (Integer) firstStartPlayBufferTime : (Long) firstStartPlayBufferTime)); pigeonResult.setFirstStartPlayBufferTime((firstStartPlayBufferTime == null) ? null : ((firstStartPlayBufferTime instanceof Integer) ? (Integer) firstStartPlayBufferTime : (Long) firstStartPlayBufferTime));
Object nextStartPlayBufferTime = list.get(14); Object nextStartPlayBufferTime = list.get(14);
...@@ -2262,13 +2262,13 @@ public class FtxMessages { ...@@ -2262,13 +2262,13 @@ public class FtxMessages {
this.playUrl = setterArg; this.playUrl = setterArg;
} }
private @Nullable Long preloadSizeMB; private @Nullable Double preloadSizeMB;
public @Nullable Long getPreloadSizeMB() { public @Nullable Double getPreloadSizeMB() {
return preloadSizeMB; return preloadSizeMB;
} }
public void setPreloadSizeMB(@Nullable Long setterArg) { public void setPreloadSizeMB(@Nullable Double setterArg) {
this.preloadSizeMB = setterArg; this.preloadSizeMB = setterArg;
} }
...@@ -2291,9 +2291,9 @@ public class FtxMessages { ...@@ -2291,9 +2291,9 @@ public class FtxMessages {
return this; 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; this.preloadSizeMB = setterArg;
return this; return this;
} }
...@@ -2328,7 +2328,7 @@ public class FtxMessages { ...@@ -2328,7 +2328,7 @@ public class FtxMessages {
Object playUrl = list.get(0); Object playUrl = list.get(0);
pigeonResult.setPlayUrl((String) playUrl); pigeonResult.setPlayUrl((String) playUrl);
Object preloadSizeMB = list.get(1); 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); Object preferredResolution = list.get(2);
pigeonResult.setPreferredResolution((preferredResolution == null) ? null : ((preferredResolution instanceof Integer) ? (Integer) preferredResolution : (Long) preferredResolution)); pigeonResult.setPreferredResolution((preferredResolution == null) ? null : ((preferredResolution instanceof Integer) ? (Integer) preferredResolution : (Long) preferredResolution));
return pigeonResult; return pigeonResult;
...@@ -2377,13 +2377,13 @@ public class FtxMessages { ...@@ -2377,13 +2377,13 @@ public class FtxMessages {
this.playUrl = setterArg; this.playUrl = setterArg;
} }
private @Nullable Long preloadSizeMB; private @Nullable Double preloadSizeMB;
public @Nullable Long getPreloadSizeMB() { public @Nullable Double getPreloadSizeMB() {
return preloadSizeMB; return preloadSizeMB;
} }
public void setPreloadSizeMB(@Nullable Long setterArg) { public void setPreloadSizeMB(@Nullable Double setterArg) {
this.preloadSizeMB = setterArg; this.preloadSizeMB = setterArg;
} }
...@@ -2437,9 +2437,9 @@ public class FtxMessages { ...@@ -2437,9 +2437,9 @@ public class FtxMessages {
return this; 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; this.preloadSizeMB = setterArg;
return this; return this;
} }
...@@ -2495,7 +2495,7 @@ public class FtxMessages { ...@@ -2495,7 +2495,7 @@ public class FtxMessages {
Object playUrl = list.get(3); Object playUrl = list.get(3);
pigeonResult.setPlayUrl((String) playUrl); pigeonResult.setPlayUrl((String) playUrl);
Object preloadSizeMB = list.get(4); 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); Object preferredResolution = list.get(5);
pigeonResult.setPreferredResolution((preferredResolution == null) ? null : ((preferredResolution instanceof Integer) ? (Integer) preferredResolution : (Long) preferredResolution)); pigeonResult.setPreferredResolution((preferredResolution == null) ? null : ((preferredResolution instanceof Integer) ? (Integer) preferredResolution : (Long) preferredResolution));
Object tmpPreloadTaskId = list.get(6); Object tmpPreloadTaskId = list.get(6);
......
...@@ -1268,7 +1268,7 @@ Future<void> exitPictureInPictureMode() async; ...@@ -1268,7 +1268,7 @@ Future<void> exitPictureInPictureMode() async;
| 参数名 | 类型 | 描述 | | 参数名 | 类型 | 描述 |
| ------ | ------ | ------------------ | | ------ |--------| ------------------ |
| connectRetryCount | int | 播放器重连次数,当SDK与服务器异常断开连接时,SDK会尝试与服务器重连.通过该值设置SDK重连次数 | | connectRetryCount | int | 播放器重连次数,当SDK与服务器异常断开连接时,SDK会尝试与服务器重连.通过该值设置SDK重连次数 |
| connectRetryInterval | int | 播放器重连间隔,当SDK与服务器异常断开连接时,SDK会尝试与服务器重连.通过该值设置两次重连间隔时间 | | connectRetryInterval | int | 播放器重连间隔,当SDK与服务器异常断开连接时,SDK会尝试与服务器重连.通过该值设置两次重连间隔时间 |
| timeout | int | 播放器连接超时时间 | | timeout | int | 播放器连接超时时间 |
...@@ -1279,8 +1279,8 @@ Future<void> exitPictureInPictureMode() async; ...@@ -1279,8 +1279,8 @@ Future<void> exitPictureInPictureMode() async;
| smoothSwitchBitrate | bool | 平滑切换多码率HLS,默认false。设为false时,可提高多码率地址打开速度; 设为true,在IDR对齐时可平滑切换码率 | | smoothSwitchBitrate | bool | 平滑切换多码率HLS,默认false。设为false时,可提高多码率地址打开速度; 设为true,在IDR对齐时可平滑切换码率 |
| cacheMp4ExtName | String | 缓存mp4文件扩展名,默认mp4 | | cacheMp4ExtName | String | 缓存mp4文件扩展名,默认mp4 |
| progressInterval | int | 设置进度回调间隔,若不设置,SDK默认间隔0.5秒回调一次,单位毫秒 | | progressInterval | int | 设置进度回调间隔,若不设置,SDK默认间隔0.5秒回调一次,单位毫秒 |
| maxBufferSize | int | 最大播放缓冲大小,单位 MB。此设置会影响playableDuration,设置越大,提前缓存的越多| | maxBufferSize | double | 最大播放缓冲大小,单位 MB。此设置会影响playableDuration,设置越大,提前缓存的越多|
| maxPreloadSize | int | 预加载最大缓冲大小,单位:MB| | maxPreloadSize | double | 预加载最大缓冲大小,单位:MB|
| firstStartPlayBufferTime | int | 首缓需要加载的数据时长,单位ms,默认值为100ms| | firstStartPlayBufferTime | int | 首缓需要加载的数据时长,单位ms,默认值为100ms|
| nextStartPlayBufferTime | int | 缓冲时(缓冲数据不够引起的二次缓冲,或者seek引起的拖动缓冲)最少要缓存多长的数据才能结束缓冲,单位ms,默认值为250ms| | nextStartPlayBufferTime | int | 缓冲时(缓冲数据不够引起的二次缓冲,或者seek引起的拖动缓冲)最少要缓存多长的数据才能结束缓冲,单位ms,默认值为250ms|
| overlayKey | String | HLS安全加固加解密key| | overlayKey | String | HLS安全加固加解密key|
...@@ -1696,7 +1696,7 @@ Future<int> switchStream(String url) async; ...@@ -1696,7 +1696,7 @@ Future<int> switchStream(String url) async;
```dart ```dart
Future<int> startPreLoad( Future<int> startPreLoad(
final String playUrl, final String playUrl,
final int preloadSizeMB, final double preloadSizeMB,
final int preferredResolution, { final int preferredResolution, {
FTXPredownlodOnCompleteListener? onCompleteListener, FTXPredownlodOnCompleteListener? onCompleteListener,
FTXPredownlodOnErrorListener? onErrorListener, FTXPredownlodOnErrorListener? onErrorListener,
...@@ -1705,7 +1705,7 @@ FTXPredownlodOnCompleteListener? onCompleteListener, ...@@ -1705,7 +1705,7 @@ FTXPredownlodOnCompleteListener? onCompleteListener,
```dart ```dart
Future<void> startPreload(TXPlayInfoParams txPlayInfoParams, Future<void> startPreload(TXPlayInfoParams txPlayInfoParams,
final int preloadSizeMB, final double preloadSizeMB,
final int preferredResolution, { final int preferredResolution, {
FTXPredownlodOnCompleteListener? onCompleteListener, FTXPredownlodOnCompleteListener? onCompleteListener,
FTXPredownlodOnErrorListener? onErrorListener, FTXPredownlodOnErrorListener? onErrorListener,
...@@ -1716,9 +1716,9 @@ FTXPredownlodOnCompleteListener? onCompleteListener, ...@@ -1716,9 +1716,9 @@ FTXPredownlodOnCompleteListener? onCompleteListener,
**参数说明** **参数说明**
| 参数名 | 类型 | 描述 | | 参数名 | 类型 | 描述 |
| ------ | ------ | ------------------ | | ------ |----------------------------------| ------------------ |
| playUrl | String | 要预下载的url| | playUrl | String | 要预下载的url|
| preloadSizeMB | int | 预下载的大小(单位:MB)| | preloadSizeMB | double | 预下载的大小(单位:MB)|
| preferredResolution | int | 期望分辨率,值为高x宽。可参考如720*1080。不支持多分辨率或不需指定时,传-1| | preferredResolution | int | 期望分辨率,值为高x宽。可参考如720*1080。不支持多分辨率或不需指定时,传-1|
| onCompleteListener | FTXPredownlodOnCompleteListener? | 预下载成功回调,全局| | onCompleteListener | FTXPredownlodOnCompleteListener? | 预下载成功回调,全局|
| onErrorListener | FTXPredownlodOnErrorListener | 预下载失败回调,全局| | onErrorListener | FTXPredownlodOnErrorListener | 预下载失败回调,全局|
......
...@@ -382,7 +382,7 @@ _controller.setPlayConfig(config); ...@@ -382,7 +382,7 @@ _controller.setPlayConfig(config);
**Parameter description** **Parameter description**
| Parameter | Type | 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 | | 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 | | 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 | | timeout | int | Player connection timeout period |
...@@ -393,8 +393,8 @@ _controller.setPlayConfig(config); ...@@ -393,8 +393,8 @@ _controller.setPlayConfig(config);
| 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 | | 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 | | 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 | | 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 | | 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 | int | Maximum preload buffer size in MB | | 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 | | 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 | | 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 | | overlayKey | String | HLS security hardening encryption and decryption key |
......
...@@ -399,7 +399,7 @@ _controller.setPlayConfig(config); ...@@ -399,7 +399,7 @@ _controller.setPlayConfig(config);
**参数说明** **参数说明**
| 参数名 | 类型 | 描述 | | 参数名 | 类型 | 描述 |
| ------ | ------ | ------------------ | | ------ |--------| ------------------ |
| connectRetryCount | int | 播放器重连次数,当SDK与服务器异常断开连接时,SDK会尝试与服务器重连.通过该值设置SDK重连次数 | | connectRetryCount | int | 播放器重连次数,当SDK与服务器异常断开连接时,SDK会尝试与服务器重连.通过该值设置SDK重连次数 |
| connectRetryInterval | int | 播放器重连间隔,当SDK与服务器异常断开连接时,SDK会尝试与服务器重连.通过该值设置两次重连间隔时间 | | connectRetryInterval | int | 播放器重连间隔,当SDK与服务器异常断开连接时,SDK会尝试与服务器重连.通过该值设置两次重连间隔时间 |
| timeout | int | 播放器连接超时时间 | | timeout | int | 播放器连接超时时间 |
...@@ -410,8 +410,8 @@ _controller.setPlayConfig(config); ...@@ -410,8 +410,8 @@ _controller.setPlayConfig(config);
| smoothSwitchBitrate | bool | 平滑切换多码率HLS,默认false。设为false时,可提高多码率地址打开速度; 设为true,在IDR对齐时可平滑切换码率 | | smoothSwitchBitrate | bool | 平滑切换多码率HLS,默认false。设为false时,可提高多码率地址打开速度; 设为true,在IDR对齐时可平滑切换码率 |
| cacheMp4ExtName | String | 缓存mp4文件扩展名,默认mp4 | | cacheMp4ExtName | String | 缓存mp4文件扩展名,默认mp4 |
| progressInterval | int | 设置进度回调间隔,若不设置,SDK默认间隔0.5秒回调一次,单位毫秒 | | progressInterval | int | 设置进度回调间隔,若不设置,SDK默认间隔0.5秒回调一次,单位毫秒 |
| maxBufferSize | int | 最大播放缓冲大小,单位 MB。此设置会影响playableDuration,设置越大,提前缓存的越多| | maxBufferSize | double | 最大播放缓冲大小,单位 MB。此设置会影响playableDuration,设置越大,提前缓存的越多|
| maxPreloadSize | int | 预加载最大缓冲大小,单位:MB| | maxPreloadSize | double | 预加载最大缓冲大小,单位:MB|
| firstStartPlayBufferTime | int | 首缓需要加载的数据时长,单位ms,默认值为100ms| | firstStartPlayBufferTime | int | 首缓需要加载的数据时长,单位ms,默认值为100ms|
| nextStartPlayBufferTime | int | 缓冲时(缓冲数据不够引起的二次缓冲,或者seek引起的拖动缓冲)最少要缓存多长的数据才能结束缓冲,单位ms,默认值为250ms| | nextStartPlayBufferTime | int | 缓冲时(缓冲数据不够引起的二次缓冲,或者seek引起的拖动缓冲)最少要缓存多长的数据才能结束缓冲,单位ms,默认值为250ms|
| overlayKey | String | HLS安全加固加解密key| | overlayKey | String | HLS安全加固加解密key|
......
...@@ -320,7 +320,7 @@ ...@@ -320,7 +320,7 @@
} }
- (nullable IntMsg *)startPreLoadMsg:(nonnull PreLoadMsg *)msg error:(FlutterError * _Nullable __autoreleasing * _Nonnull)error { - (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 preferredResolution = [msg.preferredResolution intValue];
int taskID = [[TXVodPreloadManager sharedManager] startPreload:msg.playUrl int taskID = [[TXVodPreloadManager sharedManager] startPreload:msg.playUrl
preloadSize:preloadSizeMB preloadSize:preloadSizeMB
...@@ -341,7 +341,7 @@ ...@@ -341,7 +341,7 @@
- (void)startPreLoadByParamsMsg:(PreLoadInfoMsg *)msg error:(FlutterError * _Nullable __autoreleasing *)error { - (void)startPreLoadByParamsMsg:(PreLoadInfoMsg *)msg error:(FlutterError * _Nullable __autoreleasing *)error {
dispatch_async(self.mPreloadQueue, ^{ dispatch_async(self.mPreloadQueue, ^{
BOOL isUrlPreload = msg.playUrl != nil && [msg.playUrl isKindOfClass:[NSString class]] && msg.playUrl.length > 0; 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]; int preferredResolution = [msg.preferredResolution intValue];
long tmpTaskId = [msg.tmpPreloadTaskId longValue]; long tmpTaskId = [msg.tmpPreloadTaskId longValue];
NSString *fileId = (msg.fileId != nil && [msg.fileId isKindOfClass:[NSString class]]) ? msg.fileId : @""; NSString *fileId = (msg.fileId != nil && [msg.fileId isKindOfClass:[NSString class]]) ? msg.fileId : @"";
......
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
config.enableAccurateSeek = msg.enableAccurateSeek.boolValue; config.enableAccurateSeek = msg.enableAccurateSeek.boolValue;
config.autoRotate = msg.autoRotate.boolValue; config.autoRotate = msg.autoRotate.boolValue;
config.smoothSwitchBitrate = msg.smoothSwitchBitrate.boolValue; config.smoothSwitchBitrate = msg.smoothSwitchBitrate.boolValue;
config.maxBufferSize = msg.maxBufferSize.intValue; config.maxBufferSize = msg.maxBufferSize.floatValue;
config.maxPreloadSize = msg.maxPreloadSize.intValue; config.maxPreloadSize = msg.maxPreloadSize.floatValue;
config.firstStartPlayBufferTime = msg.firstStartPlayBufferTime.intValue; config.firstStartPlayBufferTime = msg.firstStartPlayBufferTime.intValue;
config.nextStartPlayBufferTime = msg.nextStartPlayBufferTime.intValue; config.nextStartPlayBufferTime = msg.nextStartPlayBufferTime.intValue;
config.enableRenderProcess = msg.enableRenderProcess.boolValue; config.enableRenderProcess = msg.enableRenderProcess.boolValue;
......
...@@ -138,6 +138,9 @@ SuperPlayerPlugin* instance; ...@@ -138,6 +138,9 @@ SuperPlayerPlugin* instance;
[player notifyAppTerminate:application]; [player notifyAppTerminate:application];
} }
} }
if (nil != _fTXDownloadManager) {
[_fTXDownloadManager destroy];
}
} }
#pragma mark - FlutterStreamHandler #pragma mark - FlutterStreamHandler
......
// Copyright (c) 2022 Tencent. All rights reserved. Copyright (c) 2022 Tencent. All rights reserved.
\ No newline at end of file \ No newline at end of file
...@@ -110,10 +110,10 @@ class FTXVodPlayConfigPlayerMsg { ...@@ -110,10 +110,10 @@ class FTXVodPlayConfigPlayerMsg {
int? progressInterval; int? progressInterval;
// 最大播放缓冲大小,单位 MB。此设置会影响playableDuration,设置越大,提前缓存的越多 // 最大播放缓冲大小,单位 MB。此设置会影响playableDuration,设置越大,提前缓存的越多
int? maxBufferSize; double? maxBufferSize;
// 预加载最大缓冲大小,单位:MB // 预加载最大缓冲大小,单位:MB
int? maxPreloadSize; double? maxPreloadSize;
// 首缓需要加载的数据时长,单位ms,默认值为100ms // 首缓需要加载的数据时长,单位ms,默认值为100ms
int? firstStartPlayBufferTime; int? firstStartPlayBufferTime;
...@@ -263,7 +263,7 @@ class DoubleMsg { ...@@ -263,7 +263,7 @@ class DoubleMsg {
class PreLoadMsg { class PreLoadMsg {
String? playUrl; String? playUrl;
int? preloadSizeMB; double? preloadSizeMB;
int? preferredResolution; int? preferredResolution;
} }
...@@ -272,7 +272,7 @@ class PreLoadInfoMsg { ...@@ -272,7 +272,7 @@ class PreLoadInfoMsg {
String? fileId; String? fileId;
String? pSign; String? pSign;
String? playUrl; String? playUrl;
int? preloadSizeMB; double? preloadSizeMB;
int? preferredResolution; int? preferredResolution;
int? tmpPreloadTaskId; int? tmpPreloadTaskId;
} }
......
...@@ -351,9 +351,9 @@ class FTXVodPlayConfigPlayerMsg { ...@@ -351,9 +351,9 @@ class FTXVodPlayConfigPlayerMsg {
int? progressInterval; int? progressInterval;
int? maxBufferSize; double? maxBufferSize;
int? maxPreloadSize; double? maxPreloadSize;
int? firstStartPlayBufferTime; int? firstStartPlayBufferTime;
...@@ -408,8 +408,8 @@ class FTXVodPlayConfigPlayerMsg { ...@@ -408,8 +408,8 @@ class FTXVodPlayConfigPlayerMsg {
smoothSwitchBitrate: result[8] as bool?, smoothSwitchBitrate: result[8] as bool?,
cacheMp4ExtName: result[9] as String?, cacheMp4ExtName: result[9] as String?,
progressInterval: result[10] as int?, progressInterval: result[10] as int?,
maxBufferSize: result[11] as int?, maxBufferSize: result[11] as double?,
maxPreloadSize: result[12] as int?, maxPreloadSize: result[12] as double?,
firstStartPlayBufferTime: result[13] as int?, firstStartPlayBufferTime: result[13] as int?,
nextStartPlayBufferTime: result[14] as int?, nextStartPlayBufferTime: result[14] as int?,
overlayKey: result[15] as String?, overlayKey: result[15] as String?,
...@@ -768,7 +768,7 @@ class PreLoadMsg { ...@@ -768,7 +768,7 @@ class PreLoadMsg {
String? playUrl; String? playUrl;
int? preloadSizeMB; double? preloadSizeMB;
int? preferredResolution; int? preferredResolution;
...@@ -784,7 +784,7 @@ class PreLoadMsg { ...@@ -784,7 +784,7 @@ class PreLoadMsg {
result as List<Object?>; result as List<Object?>;
return PreLoadMsg( return PreLoadMsg(
playUrl: result[0] as String?, playUrl: result[0] as String?,
preloadSizeMB: result[1] as int?, preloadSizeMB: result[1] as double?,
preferredResolution: result[2] as int?, preferredResolution: result[2] as int?,
); );
} }
...@@ -809,7 +809,7 @@ class PreLoadInfoMsg { ...@@ -809,7 +809,7 @@ class PreLoadInfoMsg {
String? playUrl; String? playUrl;
int? preloadSizeMB; double? preloadSizeMB;
int? preferredResolution; int? preferredResolution;
...@@ -834,7 +834,7 @@ class PreLoadInfoMsg { ...@@ -834,7 +834,7 @@ class PreLoadInfoMsg {
fileId: result[1] as String?, fileId: result[1] as String?,
pSign: result[2] as String?, pSign: result[2] as String?,
playUrl: result[3] as String?, playUrl: result[3] as String?,
preloadSizeMB: result[4] as int?, preloadSizeMB: result[4] as double?,
preferredResolution: result[5] as int?, preferredResolution: result[5] as int?,
tmpPreloadTaskId: result[6] as int?, tmpPreloadTaskId: result[6] as int?,
); );
......
...@@ -55,7 +55,7 @@ class TXVodDownloadController { ...@@ -55,7 +55,7 @@ class TXVodDownloadController {
/// 返回值:任务ID,可用这个任务ID停止预下载 [stopPreload] /// 返回值:任务ID,可用这个任务ID停止预下载 [stopPreload]
Future<int> startPreLoad( Future<int> startPreLoad(
final String playUrl, final String playUrl,
final int preloadSizeMB, final double preloadSizeMB,
final int preferredResolution, { final int preferredResolution, {
FTXPredownlodOnCompleteListener? onCompleteListener, FTXPredownlodOnCompleteListener? onCompleteListener,
FTXPredownlodOnErrorListener? onErrorListener, FTXPredownlodOnErrorListener? onErrorListener,
...@@ -75,7 +75,7 @@ class TXVodDownloadController { ...@@ -75,7 +75,7 @@ class TXVodDownloadController {
Future<void> startPreload( Future<void> startPreload(
TXPlayInfoParams txPlayInfoParams, TXPlayInfoParams txPlayInfoParams,
final int preloadSizeMB, final double preloadSizeMB,
final int preferredResolution, { final int preferredResolution, {
FTXPredownlodOnCompleteListener? onCompleteListener, FTXPredownlodOnCompleteListener? onCompleteListener,
FTXPredownlodOnErrorListener? onErrorListener, FTXPredownlodOnErrorListener? onErrorListener,
......
...@@ -51,11 +51,11 @@ class FTXVodPlayConfig { ...@@ -51,11 +51,11 @@ class FTXVodPlayConfig {
// Maximum playback buffer size, in MB. This setting will affect playableDuration. // Maximum playback buffer size, in MB. This setting will affect playableDuration.
// The larger the setting, the more data will be cached in advance. // The larger the setting, the more data will be cached in advance.
// 最大播放缓冲大小,单位 MB。此设置会影响playableDuration,设置越大,提前缓存的越多 // 最大播放缓冲大小,单位 MB。此设置会影响playableDuration,设置越大,提前缓存的越多
int maxBufferSize = 0; double maxBufferSize = 10;
// Maximum preloading buffer size, in MB. // Maximum preloading buffer size, in MB.
// 预加载最大缓冲大小,单位: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. // Duration of data to be loaded for the first buffering, in milliseconds. The default value is 100ms.
// 首缓需要加载的数据时长,单位ms,默认值为100ms // 首缓需要加载的数据时长,单位ms,默认值为100ms
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论