Skip to content

Commit 3b11cac

Browse files
dokieyangkongdywang
authored andcommitted
1. Update to 12.0.1
2. The player component adds the logic of network image placeholder when there is no network. 3. Fix the issue where textures are not refreshed in some cases 4. Fix the issue where updating Picture-in-Picture produces errors when Picture-in-Picture ends in some cases 5. Modify the plugin callback Flutter side message architecture 6. During SDK initialization, all modules are changed to lazy loading 7. The demo and player components no longer need to force set the language; if not set, it defaults to English
1 parent 472c37b commit 3b11cac

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+5393
-6289
lines changed

Flutter/CHANGELOG.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ Professional 分支:Android & iOS 端集成TXLiteAVSDK_Professional lastest版
199199

200200
- set Android TXLiteAVSDK_Player to 11.9.0.14445,tag:release_player_v11.9.0
201201
- set iOS TXLiteAVSDK_Player to 11.9.15963, tag:release_player_v11.9.0
202-
- Android compatible with high version Gradle
203-
- The location of the superPlayerWidget has changed, integrating superPlayer will no longer include the source code of the superPlayerWidget
202+
- Android compatible with high version Gradle
203+
- The location of the superPlayerWidget has changed, integrating superPlayer will no longer include the source code of the superPlayerWidget
204204
- Android picture-in-picture feature logic optimization, compatible with more models
205205

206206
#### Version: 11.9.1 2024.06.05
@@ -211,7 +211,7 @@ Professional 分支:Android & iOS 端集成TXLiteAVSDK_Professional lastest版
211211
- TXVodPlayerController has introduced a new setStringOption interface for configuring extensions.
212212
- The Flutter side's operation of the player can now affect the UI updates for playing and pausing in the picture-in-picture window.
213213
- Fixed potential memory leak issues.
214-
- Optimized the logic of superPlayer Widget
214+
- Optimized the logic of superPlayer Widget
215215
- Fixed other known issues.
216216

217217
#### Version: 12.0.0 2024.08.21
@@ -225,4 +225,16 @@ Professional 分支:Android & iOS 端集成TXLiteAVSDK_Professional lastest版
225225
- New interfaces have been added to live streaming: enableReceiveSeiMessage, showDebugView, setProperty, getSupportedBitrate, and setCacheParams.
226226
- When playing live streaming, there is no longer a need to pass the playType parameter, which has been deprecated.
227227
- The live streaming and on-demand demo pages have added logic to wait for the license to load successfully before playing.
228-
- Other known issues have been fixed.
228+
- Other known issues have been fixed.
229+
230+
#### Version: 12.0.1 2024.09.14
231+
232+
##### Features:
233+
234+
- set Android TXLiteAVSDK_Player to 12.0.0.14689,tag:release_player_v12.0.1
235+
- set iOS TXLiteAVSDK_Player to 12.0.16301, tag:release_player_v12.0.1
236+
- Fix the issue where textures are not refreshed in some cases
237+
- Fix the issue where updating Picture-in-Picture produces errors when Picture-in-Picture ends in some cases
238+
- Modify the plugin callback Flutter side message architecture
239+
- During SDK initialization, all modules are changed to lazy loading
240+
- The demo and player components no longer need to force set the language; if not set, it defaults to English

Flutter/CI/buildVersionOnMac.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildLog() {
55
}
66

77
inputVersion=$1
8-
export VERSION_NAME="12.0.0"
8+
export VERSION_NAME="12.0.1"
99
if [ -n "$inputVersion" ]; then
1010
VERSION_NAME=$inputVersion
1111
fi

Flutter/android/config.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
rootProject.ext {
2-
compileSdkVersion = 33
2+
compileSdkVersion = 31
33
buildToolsVersion = "28.0.3"
44
supportSdkVersion = "26.0.1"
55
minSdkVersion = 19
66
targetSdkVersion = 28
7-
playerVersion = '12.0.0'
7+
playerVersion = '12.0.1'
88
compat = "androidx.appcompat:appcompat:1.6.1"
99

1010
/**
@@ -14,5 +14,5 @@ rootProject.ext {
1414
Professional SDK: liteavSdk="com.tencent.liteav:LiteAVSDK_Professional:latest.release"
1515
If you want to specify the SDK version(eg 11.7.0.13946), use: liteavSdk="com.tencent.liteav:LiteAVSDK_Player:11.7.0.13946"
1616
*/
17-
liteavSdk="com.tencent.liteav:LiteAVSDK_Player:12.0.0.14681"
17+
liteavSdk="com.tencent.liteav:LiteAVSDK_Player:12.0.0.14689"
1818
}

Flutter/android/src/main/java/com/tencent/vod/flutter/FTXDownloadManager.java

Lines changed: 60 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44

55
import android.os.Bundle;
66
import android.os.Handler;
7+
import android.os.Looper;
78
import android.text.TextUtils;
89

910
import androidx.annotation.NonNull;
1011

12+
import com.tencent.liteav.base.util.LiteavLog;
1113
import com.tencent.rtmp.TXPlayInfoParams;
1214
import com.tencent.rtmp.downloader.ITXVodDownloadListener;
1315
import com.tencent.rtmp.downloader.ITXVodFilePreloadListener;
@@ -26,29 +28,29 @@
2628
import com.tencent.vod.flutter.messages.FtxMessages.TXVodDownloadMediaMsg;
2729
import com.tencent.vod.flutter.tools.TXCommonUtil;
2830

29-
import io.flutter.embedding.engine.plugins.FlutterPlugin;
30-
import io.flutter.plugin.common.EventChannel;
31-
3231
import java.math.BigDecimal;
3332
import java.util.ArrayList;
3433
import java.util.List;
3534
import java.util.Map;
3635
import java.util.concurrent.ExecutorService;
3736
import java.util.concurrent.Executors;
3837

38+
import io.flutter.embedding.engine.plugins.FlutterPlugin;
39+
3940
/**
4041
* Download management, pre-download, and offline download.
4142
*
4243
* 下载管理,预下载、离线下载
4344
*/
44-
public class FTXDownloadManager implements ITXVodDownloadListener, TXFlutterDownloadApi {
45+
public class FTXDownloadManager implements ITXVodDownloadListener, TXFlutterDownloadApi, FtxMessages.VoidResult {
4546

46-
private FlutterPlugin.FlutterPluginBinding mFlutterPluginBinding;
47-
private final EventChannel mEventChannel;
48-
private final FTXPlayerEventSink mEventSink = new FTXPlayerEventSink();
49-
private final Handler mMainHandler;
47+
private static final String TAG = "FTXDownloadManager";
5048

51-
private ExecutorService mPreloadPool = Executors.newCachedThreadPool();
49+
private final FlutterPlugin.FlutterPluginBinding mFlutterPluginBinding;
50+
private boolean isInitDownloadListener = false;
51+
private final ExecutorService mPreloadPool = Executors.newCachedThreadPool();
52+
private final FtxMessages.TXDownloadFlutterAPI mDownloadFlutterApi;
53+
private final Handler mMainHandler = new Handler(Looper.getMainLooper());
5254

5355
/**
5456
* Video download management.
@@ -57,45 +59,36 @@ public class FTXDownloadManager implements ITXVodDownloadListener, TXFlutterDown
5759
*/
5860
public FTXDownloadManager(FlutterPlugin.FlutterPluginBinding flutterPluginBinding) {
5961
mFlutterPluginBinding = flutterPluginBinding;
60-
mMainHandler = new Handler(mFlutterPluginBinding.getApplicationContext().getMainLooper());
61-
62-
TXFlutterDownloadApi.setup(mFlutterPluginBinding.getBinaryMessenger(), this);
63-
64-
mEventChannel = new EventChannel(flutterPluginBinding.getBinaryMessenger(),
65-
"cloud.tencent.com/txvodplayer/download/event");
66-
mEventChannel.setStreamHandler(new EventChannel.StreamHandler() {
67-
@Override
68-
public void onListen(Object o, EventChannel.EventSink eventSink) {
69-
mEventSink.setEventSinkProxy(eventSink);
70-
}
62+
TXFlutterDownloadApi.setUp(mFlutterPluginBinding.getBinaryMessenger(), this);
63+
mDownloadFlutterApi = new FtxMessages.TXDownloadFlutterAPI(flutterPluginBinding.getBinaryMessenger());
64+
}
7165

72-
@Override
73-
public void onCancel(Object o) {
74-
mEventSink.setEventSinkProxy(null);
75-
}
76-
});
77-
TXVodDownloadManager.getInstance().setListener(this);
66+
private void initDownloadListenerIfNeed() {
67+
if (!isInitDownloadListener) {
68+
isInitDownloadListener = true;
69+
TXVodDownloadManager.getInstance().setListener(this);
70+
}
7871
}
7972

80-
private void onStartEvent(long tmpTaskId, int taskId, String fileId, String url, Bundle params) {
73+
private void onPreLoadStartEvent(long tmpTaskId, int taskId, String fileId, String url, Bundle params) {
8174
Bundle bundle = new Bundle();
8275
bundle.putLong("tmpTaskId", tmpTaskId);
8376
bundle.putInt("taskId", taskId);
8477
bundle.putString("fileId", fileId);
8578
bundle.putString("url", url);
8679
Map<String, Object> result = TXCommonUtil.getParams(FTXEvent.EVENT_PREDOWNLOAD_ON_START, bundle);
8780
result.put("params", TXCommonUtil.transToMap(params));
88-
sendSuccessEvent(result);
81+
onPreloadCallback(result);
8982
}
9083

91-
private void onCompleteEvent(int taskId, String url) {
84+
private void onPreLoadCompleteEvent(int taskId, String url) {
9285
Bundle bundle = new Bundle();
9386
bundle.putInt("taskId", taskId);
9487
bundle.putString("url", url);
95-
sendSuccessEvent(TXCommonUtil.getParams(FTXEvent.EVENT_PREDOWNLOAD_ON_COMPLETE, bundle));
88+
onPreloadCallback(TXCommonUtil.getParams(FTXEvent.EVENT_PREDOWNLOAD_ON_COMPLETE, bundle));
9689
}
9790

98-
private void onErrorEvent(long tmpTaskId, int taskId, String url, int code, String msg) {
91+
private void onPreLoadErrorEvent(long tmpTaskId, int taskId, String url, int code, String msg) {
9992
Bundle bundle = new Bundle();
10093
if (tmpTaskId >= 0) {
10194
bundle.putLong("tmpTaskId", tmpTaskId);
@@ -104,21 +97,19 @@ private void onErrorEvent(long tmpTaskId, int taskId, String url, int code, Stri
10497
bundle.putInt("code", code);
10598
bundle.putString("url", url);
10699
bundle.putString("msg", msg);
107-
sendSuccessEvent(TXCommonUtil.getParams(FTXEvent.EVENT_PREDOWNLOAD_ON_ERROR, bundle));
100+
onPreloadCallback(TXCommonUtil.getParams(FTXEvent.EVENT_PREDOWNLOAD_ON_ERROR, bundle));
108101
}
109102

110-
private void sendSuccessEvent(final Object event) {
103+
private void onPreloadCallback(Map<String, Object> eventArg) {
111104
mMainHandler.post(new Runnable() {
112105
@Override
113106
public void run() {
114-
mEventSink.success(event);
107+
mDownloadFlutterApi.onPreDownloadEvent(eventArg, FTXDownloadManager.this);
115108
}
116109
});
117110
}
118111

119-
120112
public void destroy() {
121-
mEventChannel.setStreamHandler(null);
122113
TXVodDownloadManager.getInstance().setListener(null);
123114
}
124115

@@ -239,34 +230,42 @@ private int optQuality(Integer quality) {
239230
@Override
240231
public void onDownloadStart(TXVodDownloadMediaInfo txVodDownloadMediaInfo) {
241232
Bundle bundle = buildCommonDownloadBundle(txVodDownloadMediaInfo);
242-
sendSuccessEvent(TXCommonUtil.getParams(FTXEvent.EVENT_DOWNLOAD_START, bundle));
233+
onDownloadCallback(TXCommonUtil.getParams(FTXEvent.EVENT_DOWNLOAD_START, bundle));
243234
}
244235

245-
246236
@Override
247237
public void onDownloadProgress(TXVodDownloadMediaInfo txVodDownloadMediaInfo) {
248238
Bundle bundle = buildCommonDownloadBundle(txVodDownloadMediaInfo);
249-
sendSuccessEvent(TXCommonUtil.getParams(FTXEvent.EVENT_DOWNLOAD_PROGRESS, bundle));
239+
onDownloadCallback(TXCommonUtil.getParams(FTXEvent.EVENT_DOWNLOAD_PROGRESS, bundle));
250240
}
251241

252242
@Override
253243
public void onDownloadStop(TXVodDownloadMediaInfo txVodDownloadMediaInfo) {
254244
Bundle bundle = buildCommonDownloadBundle(txVodDownloadMediaInfo);
255-
sendSuccessEvent(TXCommonUtil.getParams(FTXEvent.EVENT_DOWNLOAD_STOP, bundle));
245+
onDownloadCallback(TXCommonUtil.getParams(FTXEvent.EVENT_DOWNLOAD_STOP, bundle));
256246
}
257247

258248
@Override
259249
public void onDownloadFinish(TXVodDownloadMediaInfo txVodDownloadMediaInfo) {
260250
Bundle bundle = buildCommonDownloadBundle(txVodDownloadMediaInfo);
261-
sendSuccessEvent(TXCommonUtil.getParams(FTXEvent.EVENT_DOWNLOAD_FINISH, bundle));
251+
onDownloadCallback(TXCommonUtil.getParams(FTXEvent.EVENT_DOWNLOAD_FINISH, bundle));
262252
}
263253

264254
@Override
265255
public void onDownloadError(TXVodDownloadMediaInfo txVodDownloadMediaInfo, int i, String s) {
266256
Bundle bundle = buildCommonDownloadBundle(txVodDownloadMediaInfo);
267257
bundle.putInt("errorCode", i);
268258
bundle.putString("errorMsg", s);
269-
sendSuccessEvent(TXCommonUtil.getParams(FTXEvent.EVENT_DOWNLOAD_ERROR, bundle));
259+
onDownloadCallback(TXCommonUtil.getParams(FTXEvent.EVENT_DOWNLOAD_ERROR, bundle));
260+
}
261+
262+
private void onDownloadCallback(Map<String, Object> eventArg) {
263+
mMainHandler.post(new Runnable() {
264+
@Override
265+
public void run() {
266+
mDownloadFlutterApi.onDownloadEvent(eventArg, FTXDownloadManager.this);
267+
}
268+
});
270269
}
271270

272271
/**
@@ -291,20 +290,19 @@ public IntMsg startPreLoad(@NonNull PreLoadMsg msg) {
291290
new ITXVodPreloadListener() {
292291
@Override
293292
public void onComplete(int taskID, String url) {
294-
onCompleteEvent(taskID, url);
293+
onPreLoadCompleteEvent(taskID, url);
295294
}
296295

297296
@Override
298297
public void onError(int taskID, String url, int code, String msg) {
299-
onErrorEvent(-1, taskID, url, code, msg);
298+
onPreLoadErrorEvent(-1, taskID, url, code, msg);
300299
}
301300
});
302301
IntMsg res = new IntMsg();
303302
res.setValue((long) retTaskID);
304303
return res;
305304
}
306305

307-
@NonNull
308306
@Override
309307
public void startPreLoadByParams(@NonNull FtxMessages.PreLoadInfoMsg msg) {
310308
mPreloadPool.execute(new Runnable() {
@@ -329,22 +327,22 @@ public void run() {
329327
@Override
330328
public void onStart(int taskID, String fileId, String url, Bundle bundle) {
331329
if (tmpTaskId >= 0) {
332-
onStartEvent(tmpTaskId, taskID, fileId, url, bundle);
330+
onPreLoadStartEvent(tmpTaskId, taskID, fileId, url, bundle);
333331
}
334332
}
335333

336334
@Override
337335
public void onComplete(int taskID, String url) {
338-
onCompleteEvent(taskID, url);
336+
onPreLoadCompleteEvent(taskID, url);
339337
}
340338

341339
@Override
342340
public void onError(int taskID, String url, int code, String msg) {
343-
onErrorEvent(tmpTaskId, taskID, url, code, msg);
341+
onPreLoadErrorEvent(tmpTaskId, taskID, url, code, msg);
344342
}
345343
});
346344
if (isUrlPreload && tmpTaskId >= 0) {
347-
onStartEvent(tmpTaskId, retTaskID, msg.getFileId(), msg.getPlayUrl(), new Bundle());
345+
onPreLoadStartEvent(tmpTaskId, retTaskID, msg.getFileId(), msg.getPlayUrl(), new Bundle());
348346
}
349347
}
350348
});
@@ -361,6 +359,7 @@ public void stopPreLoad(@NonNull IntMsg msg) {
361359

362360
@Override
363361
public void startDownload(@NonNull TXVodDownloadMediaMsg msg) {
362+
initDownloadListenerIfNeed();
364363
Integer quality = null != msg.getQuality() ? msg.getQuality().intValue() : 0;
365364
String videoUrl = msg.getUrl();
366365
Integer appId = null != msg.getAppId() ? msg.getAppId().intValue() : null;
@@ -378,6 +377,7 @@ public void startDownload(@NonNull TXVodDownloadMediaMsg msg) {
378377

379378
@Override
380379
public void resumeDownload(@NonNull TXVodDownloadMediaMsg msg) {
380+
initDownloadListenerIfNeed();
381381
TXVodDownloadMediaInfo mediaInfo = getDownloadInfoFromMsg(msg);
382382
if (null != mediaInfo) {
383383
TXVodDownloadDataSource dataSource = mediaInfo.getDataSource();
@@ -391,6 +391,7 @@ public void resumeDownload(@NonNull TXVodDownloadMediaMsg msg) {
391391

392392
@Override
393393
public void stopDownload(@NonNull TXVodDownloadMediaMsg msg) {
394+
initDownloadListenerIfNeed();
394395
TXVodDownloadMediaInfo mediaInfo = getDownloadInfoFromMsg(msg);
395396
TXVodDownloadManager.getInstance().stopDownload(mediaInfo);
396397
}
@@ -426,10 +427,20 @@ public BoolMsg deleteDownloadMediaInfo(@NonNull TXVodDownloadMediaMsg msg) {
426427
TXVodDownloadMediaInfo mediaInfo = getDownloadInfoFromMsg(msg);
427428
boolean deleteResult = false;
428429
if (mediaInfo != null) {
430+
TXVodDownloadManager.getInstance().stopDownload(mediaInfo);
429431
deleteResult = TXVodDownloadManager.getInstance().deleteDownloadMediaInfo(mediaInfo);
430432
}
431433
BoolMsg res = new BoolMsg();
432434
res.setValue(deleteResult);
433435
return res;
434436
}
437+
438+
@Override
439+
public void success() {
440+
}
441+
442+
@Override
443+
public void error(@NonNull Throwable error) {
444+
LiteavLog.e(TAG, "callback message error:" + error);
445+
}
435446
}

0 commit comments

Comments
 (0)