Skip to content

Commit 4d51c9c

Browse files
author
kongdywang
committed
1. The Android rendering texture is modified to PlatformView, which can be input with the androidRenderType enumeration type to determine whether the Android end uses SurfaceView or TextureView.
2. Upgrade the version number to 12.3.1. 3. Support specifying the default audio track.
1 parent 991420a commit 4d51c9c

File tree

67 files changed

+1732
-641
lines changed

Some content is hidden

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

67 files changed

+1732
-641
lines changed

Flutter/CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,4 +278,3 @@
278278
- iOS端新增画中画(PIP) 功能
279279
- set Android TXLiteAVSDK_Player to 10.3.0.11144,tag:release_player_v1.0.3
280280
- set iOS TXLiteAVSDK_Player to 10.3.11513, tag:release_pro_v1.0.3
281-

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.3.0"
8+
export VERSION_NAME="12.3.1"
99
if [ -n "$inputVersion" ]; then
1010
VERSION_NAME=$inputVersion
1111
fi

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99
*/
1010
public class FTXEvent {
1111

12+
public interface ViewType {
13+
int TEXTURE_TYPE = 0;
14+
int SURFACE_TYPE = 1;
15+
}
16+
17+
public static final String FTX_RENDER_VIEW = "FTXRenderViewType";
18+
public static final String RENDER_TYPE_KEY = "renderViewType";
19+
1220
/*
1321
Volume change.
1422
音量变化

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ public void writeToParcel(Parcel dest, int flags) {
522522
* PIP control callback.
523523
* 画中画控制回调
524524
*/
525-
interface PipCallback {
525+
public interface PipCallback {
526526

527527
/**
528528
* Close PIP.

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public static TXVodPlayConfig transformToVodConfig(FTXVodPlayConfigPlayerMsg con
7575
if (null != configPlayerMsg.getPreferredResolution()) {
7676
playConfig.setPreferredResolution(configPlayerMsg.getPreferredResolution());
7777
}
78+
playConfig.setPreferredAudioTrack(configPlayerMsg.getPreferAudioTrack());
7879
playConfig.setMediaType(configPlayerMsg.getMediaType().intValue());
7980
playConfig.setEncryptedMp4Level(configPlayerMsg.getEncryptedMp4Level().intValue());
8081
return playConfig;

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

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,13 @@
3939
import com.tencent.vod.flutter.messages.FtxMessages.StringMsg;
4040
import com.tencent.vod.flutter.messages.FtxMessages.TXFlutterNativeAPI;
4141
import com.tencent.vod.flutter.messages.FtxMessages.TXFlutterSuperPlayerPluginAPI;
42+
import com.tencent.vod.flutter.player.FTXBasePlayer;
43+
import com.tencent.vod.flutter.player.FTXLivePlayer;
44+
import com.tencent.vod.flutter.player.FTXVodPlayer;
4245
import com.tencent.vod.flutter.tools.TXCommonUtil;
4346
import com.tencent.vod.flutter.tools.TXFlutterEngineHolder;
4447
import com.tencent.vod.flutter.ui.TXAndroid12BridgeService;
48+
import com.tencent.vod.flutter.ui.render.FTXRenderViewFactory;
4549

4650
import java.io.File;
4751
import java.math.BigDecimal;
@@ -84,6 +88,7 @@ public class SuperPlayerPlugin implements FlutterPlugin, ActivityAware,
8488
private boolean mIsBrightnessObserverRegistered = false;
8589
private final Handler mMainHandler = new Handler(Looper.getMainLooper());
8690
private FtxMessages.TXPluginFlutterAPI mPluginApi;
91+
private FTXRenderViewFactory mRenderViewFactory;
8792

8893
private final FTXAudioManager.AudioFocusChangeListener audioFocusChangeListener =
8994
new FTXAudioManager.AudioFocusChangeListener() {
@@ -175,6 +180,10 @@ public void onCustomHttpDNS(String hostName, List<String> ipList) {
175180
@Override
176181
public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) {
177182
LiteavLog.i(TAG, "onAttachedToEngine");
183+
mRenderViewFactory = new FTXRenderViewFactory(flutterPluginBinding.getBinaryMessenger());
184+
flutterPluginBinding
185+
.getPlatformViewRegistry()
186+
.registerViewFactory(FTXEvent.FTX_RENDER_VIEW, mRenderViewFactory);
178187
TXFlutterSuperPlayerPluginAPI.setUp(flutterPluginBinding.getBinaryMessenger(), this);
179188
TXFlutterNativeAPI.setUp(flutterPluginBinding.getBinaryMessenger(), this);
180189
mPluginApi = new FtxMessages.TXPluginFlutterAPI(flutterPluginBinding.getBinaryMessenger());
@@ -198,8 +207,8 @@ public StringMsg getPlatformVersion() {
198207

199208
@NonNull
200209
@Override
201-
public PlayerMsg createVodPlayer() {
202-
FTXVodPlayer player = new FTXVodPlayer(mFlutterPluginBinding, getPipManager());
210+
public PlayerMsg createVodPlayer(@NonNull Boolean onlyAudio) {
211+
FTXVodPlayer player = new FTXVodPlayer(mFlutterPluginBinding, getPipManager(), mRenderViewFactory, onlyAudio);
203212
int playerId = player.getPlayerId();
204213
mPlayers.append(playerId, player);
205214
PlayerMsg playerMsg = new PlayerMsg();
@@ -210,8 +219,8 @@ public PlayerMsg createVodPlayer() {
210219

211220
@NonNull
212221
@Override
213-
public PlayerMsg createLivePlayer() {
214-
FTXLivePlayer player = new FTXLivePlayer(mFlutterPluginBinding, getPipManager());
222+
public PlayerMsg createLivePlayer(@NonNull Boolean onlyAudio) {
223+
FTXLivePlayer player = new FTXLivePlayer(mFlutterPluginBinding, getPipManager(), mRenderViewFactory, onlyAudio);
215224
int playerId = player.getPlayerId();
216225
mPlayers.append(playerId, player);
217226
PlayerMsg playerMsg = new PlayerMsg();

Flutter/android/src/main/java/com/tencent/vod/flutter/messages/FtxMessages.java

Lines changed: 84 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright (c) 2022 Tencent. All rights reserved.
2-
// Autogenerated from Pigeon (v22.6.1), do not edit directly.
2+
// Autogenerated from Pigeon (v22.7.0), do not edit directly.
33
// See also: https://pub.dev/packages/pigeon
44

55
package com.tencent.vod.flutter.messages;
@@ -1385,17 +1385,27 @@ public void setEncryptedMp4Level(@Nullable Long setterArg) {
13851385
this.encryptedMp4Level = setterArg;
13861386
}
13871387

1388+
private @Nullable String preferAudioTrack;
1389+
1390+
public @Nullable String getPreferAudioTrack() {
1391+
return preferAudioTrack;
1392+
}
1393+
1394+
public void setPreferAudioTrack(@Nullable String setterArg) {
1395+
this.preferAudioTrack = setterArg;
1396+
}
1397+
13881398
@Override
13891399
public boolean equals(Object o) {
13901400
if (this == o) { return true; }
13911401
if (o == null || getClass() != o.getClass()) { return false; }
13921402
FTXVodPlayConfigPlayerMsg that = (FTXVodPlayConfigPlayerMsg) o;
1393-
return Objects.equals(playerId, that.playerId) && Objects.equals(connectRetryCount, that.connectRetryCount) && Objects.equals(connectRetryInterval, that.connectRetryInterval) && Objects.equals(timeout, that.timeout) && Objects.equals(playerType, that.playerType) && Objects.equals(headers, that.headers) && Objects.equals(enableAccurateSeek, that.enableAccurateSeek) && Objects.equals(autoRotate, that.autoRotate) && Objects.equals(smoothSwitchBitrate, that.smoothSwitchBitrate) && Objects.equals(cacheMp4ExtName, that.cacheMp4ExtName) && Objects.equals(progressInterval, that.progressInterval) && Objects.equals(maxBufferSize, that.maxBufferSize) && Objects.equals(maxPreloadSize, that.maxPreloadSize) && Objects.equals(firstStartPlayBufferTime, that.firstStartPlayBufferTime) && Objects.equals(nextStartPlayBufferTime, that.nextStartPlayBufferTime) && Objects.equals(overlayKey, that.overlayKey) && Objects.equals(overlayIv, that.overlayIv) && Objects.equals(extInfoMap, that.extInfoMap) && Objects.equals(enableRenderProcess, that.enableRenderProcess) && Objects.equals(preferredResolution, that.preferredResolution) && Objects.equals(mediaType, that.mediaType) && Objects.equals(encryptedMp4Level, that.encryptedMp4Level);
1403+
return Objects.equals(playerId, that.playerId) && Objects.equals(connectRetryCount, that.connectRetryCount) && Objects.equals(connectRetryInterval, that.connectRetryInterval) && Objects.equals(timeout, that.timeout) && Objects.equals(playerType, that.playerType) && Objects.equals(headers, that.headers) && Objects.equals(enableAccurateSeek, that.enableAccurateSeek) && Objects.equals(autoRotate, that.autoRotate) && Objects.equals(smoothSwitchBitrate, that.smoothSwitchBitrate) && Objects.equals(cacheMp4ExtName, that.cacheMp4ExtName) && Objects.equals(progressInterval, that.progressInterval) && Objects.equals(maxBufferSize, that.maxBufferSize) && Objects.equals(maxPreloadSize, that.maxPreloadSize) && Objects.equals(firstStartPlayBufferTime, that.firstStartPlayBufferTime) && Objects.equals(nextStartPlayBufferTime, that.nextStartPlayBufferTime) && Objects.equals(overlayKey, that.overlayKey) && Objects.equals(overlayIv, that.overlayIv) && Objects.equals(extInfoMap, that.extInfoMap) && Objects.equals(enableRenderProcess, that.enableRenderProcess) && Objects.equals(preferredResolution, that.preferredResolution) && Objects.equals(mediaType, that.mediaType) && Objects.equals(encryptedMp4Level, that.encryptedMp4Level) && Objects.equals(preferAudioTrack, that.preferAudioTrack);
13941404
}
13951405

13961406
@Override
13971407
public int hashCode() {
1398-
return Objects.hash(playerId, connectRetryCount, connectRetryInterval, timeout, playerType, headers, enableAccurateSeek, autoRotate, smoothSwitchBitrate, cacheMp4ExtName, progressInterval, maxBufferSize, maxPreloadSize, firstStartPlayBufferTime, nextStartPlayBufferTime, overlayKey, overlayIv, extInfoMap, enableRenderProcess, preferredResolution, mediaType, encryptedMp4Level);
1408+
return Objects.hash(playerId, connectRetryCount, connectRetryInterval, timeout, playerType, headers, enableAccurateSeek, autoRotate, smoothSwitchBitrate, cacheMp4ExtName, progressInterval, maxBufferSize, maxPreloadSize, firstStartPlayBufferTime, nextStartPlayBufferTime, overlayKey, overlayIv, extInfoMap, enableRenderProcess, preferredResolution, mediaType, encryptedMp4Level, preferAudioTrack);
13991409
}
14001410

14011411
public static final class Builder {
@@ -1576,6 +1586,14 @@ public static final class Builder {
15761586
return this;
15771587
}
15781588

1589+
private @Nullable String preferAudioTrack;
1590+
1591+
@CanIgnoreReturnValue
1592+
public @NonNull Builder setPreferAudioTrack(@Nullable String setterArg) {
1593+
this.preferAudioTrack = setterArg;
1594+
return this;
1595+
}
1596+
15791597
public @NonNull FTXVodPlayConfigPlayerMsg build() {
15801598
FTXVodPlayConfigPlayerMsg pigeonReturn = new FTXVodPlayConfigPlayerMsg();
15811599
pigeonReturn.setPlayerId(playerId);
@@ -1600,13 +1618,14 @@ public static final class Builder {
16001618
pigeonReturn.setPreferredResolution(preferredResolution);
16011619
pigeonReturn.setMediaType(mediaType);
16021620
pigeonReturn.setEncryptedMp4Level(encryptedMp4Level);
1621+
pigeonReturn.setPreferAudioTrack(preferAudioTrack);
16031622
return pigeonReturn;
16041623
}
16051624
}
16061625

16071626
@NonNull
16081627
ArrayList<Object> toList() {
1609-
ArrayList<Object> toListResult = new ArrayList<>(22);
1628+
ArrayList<Object> toListResult = new ArrayList<>(23);
16101629
toListResult.add(playerId);
16111630
toListResult.add(connectRetryCount);
16121631
toListResult.add(connectRetryInterval);
@@ -1629,6 +1648,7 @@ ArrayList<Object> toList() {
16291648
toListResult.add(preferredResolution);
16301649
toListResult.add(mediaType);
16311650
toListResult.add(encryptedMp4Level);
1651+
toListResult.add(preferAudioTrack);
16321652
return toListResult;
16331653
}
16341654

@@ -1678,6 +1698,8 @@ ArrayList<Object> toList() {
16781698
pigeonResult.setMediaType((Long) mediaType);
16791699
Object encryptedMp4Level = pigeonVar_list.get(21);
16801700
pigeonResult.setEncryptedMp4Level((Long) encryptedMp4Level);
1701+
Object preferAudioTrack = pigeonVar_list.get(22);
1702+
pigeonResult.setPreferAudioTrack((String) preferAudioTrack);
16811703
return pigeonResult;
16821704
}
16831705
}
@@ -4007,10 +4029,10 @@ public interface TXFlutterSuperPlayerPluginAPI {
40074029
StringMsg getPlatformVersion();
40084030
/** 创建点播播放器 */
40094031
@NonNull
4010-
PlayerMsg createVodPlayer();
4032+
PlayerMsg createVodPlayer(@NonNull Boolean onlyAudio);
40114033
/** 创建直播播放器 */
40124034
@NonNull
4013-
PlayerMsg createLivePlayer();
4035+
PlayerMsg createLivePlayer(@NonNull Boolean onlyAudio);
40144036
/** 开关log输出 */
40154037
void setConsoleEnabled(@NonNull BoolMsg enabled);
40164038
/** 释放播放器资源 */
@@ -4112,8 +4134,10 @@ static void setUp(@NonNull BinaryMessenger binaryMessenger, @NonNull String mess
41124134
channel.setMessageHandler(
41134135
(message, reply) -> {
41144136
ArrayList<Object> wrapped = new ArrayList<>();
4137+
ArrayList<Object> args = (ArrayList<Object>) message;
4138+
Boolean onlyAudioArg = (Boolean) args.get(0);
41154139
try {
4116-
PlayerMsg output = api.createVodPlayer();
4140+
PlayerMsg output = api.createVodPlayer(onlyAudioArg);
41174141
wrapped.add(0, output);
41184142
}
41194143
catch (Throwable exception) {
@@ -4133,8 +4157,10 @@ static void setUp(@NonNull BinaryMessenger binaryMessenger, @NonNull String mess
41334157
channel.setMessageHandler(
41344158
(message, reply) -> {
41354159
ArrayList<Object> wrapped = new ArrayList<>();
4160+
ArrayList<Object> args = (ArrayList<Object>) message;
4161+
Boolean onlyAudioArg = (Boolean) args.get(0);
41364162
try {
4137-
PlayerMsg output = api.createLivePlayer();
4163+
PlayerMsg output = api.createLivePlayer(onlyAudioArg);
41384164
wrapped.add(0, output);
41394165
}
41404166
catch (Throwable exception) {
@@ -4963,6 +4989,8 @@ public interface TXFlutterVodPlayerApi {
49634989

49644990
void setStringOption(@NonNull StringOptionPlayerMsg playerMsg);
49654991

4992+
void setPlayerView(@NonNull Long renderViewId);
4993+
49664994
/** The codec used by TXFlutterVodPlayerApi. */
49674995
static @NonNull MessageCodec<Object> getCodec() {
49684996
return PigeonCodec.INSTANCE;
@@ -5907,6 +5935,29 @@ static void setUp(@NonNull BinaryMessenger binaryMessenger, @NonNull String mess
59075935
api.setStringOption(playerMsgArg);
59085936
wrapped.add(0, null);
59095937
}
5938+
catch (Throwable exception) {
5939+
wrapped = wrapError(exception);
5940+
}
5941+
reply.reply(wrapped);
5942+
});
5943+
} else {
5944+
channel.setMessageHandler(null);
5945+
}
5946+
}
5947+
{
5948+
BasicMessageChannel<Object> channel =
5949+
new BasicMessageChannel<>(
5950+
binaryMessenger, "dev.flutter.pigeon.super_player.TXFlutterVodPlayerApi.setPlayerView" + messageChannelSuffix, getCodec());
5951+
if (api != null) {
5952+
channel.setMessageHandler(
5953+
(message, reply) -> {
5954+
ArrayList<Object> wrapped = new ArrayList<>();
5955+
ArrayList<Object> args = (ArrayList<Object>) message;
5956+
Long renderViewIdArg = (Long) args.get(0);
5957+
try {
5958+
api.setPlayerView(renderViewIdArg);
5959+
wrapped.add(0, null);
5960+
}
59105961
catch (Throwable exception) {
59115962
wrapped = wrapError(exception);
59125963
}
@@ -5998,6 +6049,8 @@ public interface TXFlutterLivePlayerApi {
59986049
@NonNull
59996050
Long enablePictureInPicture(@NonNull BoolPlayerMsg msg);
60006051

6052+
void setPlayerView(@NonNull Long renderViewId);
6053+
60016054
/** The codec used by TXFlutterLivePlayerApi. */
60026055
static @NonNull MessageCodec<Object> getCodec() {
60036056
return PigeonCodec.INSTANCE;
@@ -6489,6 +6542,29 @@ static void setUp(@NonNull BinaryMessenger binaryMessenger, @NonNull String mess
64896542
Long output = api.enablePictureInPicture(msgArg);
64906543
wrapped.add(0, output);
64916544
}
6545+
catch (Throwable exception) {
6546+
wrapped = wrapError(exception);
6547+
}
6548+
reply.reply(wrapped);
6549+
});
6550+
} else {
6551+
channel.setMessageHandler(null);
6552+
}
6553+
}
6554+
{
6555+
BasicMessageChannel<Object> channel =
6556+
new BasicMessageChannel<>(
6557+
binaryMessenger, "dev.flutter.pigeon.super_player.TXFlutterLivePlayerApi.setPlayerView" + messageChannelSuffix, getCodec());
6558+
if (api != null) {
6559+
channel.setMessageHandler(
6560+
(message, reply) -> {
6561+
ArrayList<Object> wrapped = new ArrayList<>();
6562+
ArrayList<Object> args = (ArrayList<Object>) message;
6563+
Long renderViewIdArg = (Long) args.get(0);
6564+
try {
6565+
api.setPlayerView(renderViewIdArg);
6566+
wrapped.add(0, null);
6567+
}
64926568
catch (Throwable exception) {
64936569
wrapped = wrapError(exception);
64946570
}

Flutter/android/src/main/java/com/tencent/vod/flutter/FTXBasePlayer.java renamed to Flutter/android/src/main/java/com/tencent/vod/flutter/player/FTXBasePlayer.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
// Copyright (c) 2022 Tencent. All rights reserved.
22

3-
package com.tencent.vod.flutter;
3+
package com.tencent.vod.flutter.player;
4+
5+
import com.tencent.liteav.base.util.LiteavLog;
6+
import com.tencent.vod.flutter.ui.render.FTXRenderView;
47

58
import java.util.concurrent.atomic.AtomicInteger;
69

710
/**
811
* player base
912
*/
10-
public class FTXBasePlayer {
13+
public abstract class FTXBasePlayer {
1114
private static final AtomicInteger mAtomicId = new AtomicInteger(0);
1215
private final int mPlayerId;
1316

0 commit comments

Comments
 (0)