提交 92d0fdf2 authored 作者: kongdywang's avatar kongdywang

1. update to 12.4.1

2. Remove the method of binding textures via the TXPlayerVideo's controller and add relevant explanatory comments
上级 c329dd6f
#### Version: 12.4.1 2025.04.02
##### Features:
- Remove the method of binding texture via the controller of TXPlayerVideo
#### Version: 12.4.0 2025.03.31 #### Version: 12.4.0 2025.03.31
##### Features: ##### Features:
......
...@@ -5,7 +5,7 @@ buildLog() { ...@@ -5,7 +5,7 @@ buildLog() {
} }
inputVersion=$1 inputVersion=$1
export VERSION_NAME="12.4.0" export VERSION_NAME="12.4.1"
if [ -n "$inputVersion" ]; then if [ -n "$inputVersion" ]; then
VERSION_NAME=$inputVersion VERSION_NAME=$inputVersion
fi fi
......
...@@ -4,7 +4,7 @@ rootProject.ext { ...@@ -4,7 +4,7 @@ rootProject.ext {
supportSdkVersion = "26.0.1" supportSdkVersion = "26.0.1"
minSdkVersion = 19 minSdkVersion = 19
targetSdkVersion = 28 targetSdkVersion = 28
playerVersion = "12.4.0" playerVersion = "12.4.1"
compat = "androidx.appcompat:appcompat:1.6.1" compat = "androidx.appcompat:appcompat:1.6.1"
/** /**
......
...@@ -158,6 +158,14 @@ class _DemoTXLivePlayerState extends State<DemoTXLivePlayer> with WidgetsBinding ...@@ -158,6 +158,14 @@ class _DemoTXLivePlayerState extends State<DemoTXLivePlayer> with WidgetsBinding
aspectRatio: _aspectRatio, aspectRatio: _aspectRatio,
child: TXPlayerVideo( child: TXPlayerVideo(
onRenderViewCreatedListener: (viewId) { onRenderViewCreatedListener: (viewId) {
/// 此处只展示了最基础的纹理和播放器的配置方式。 这里可记录下来 viewId,在多纹理之间进行切换,比如横竖屏切换场景,竖屏的画面,
/// 要切换到横屏的画面,可以在切换到横屏之后,拿到横屏的viewId 设置上去。回到竖屏的时候,再通过 viewId 切换回来。
/// Only the most basic configuration methods for textures and the player are shown here.
/// The `viewId` can be recorded here to switch between multiple textures. For example, in the scenario
/// of switching between portrait and landscape orientations:
/// To switch from the portrait view to the landscape view, obtain the `viewId` of the landscape view
/// after switching to landscape orientation and set it. When switching back to portrait orientation,
/// switch back using the recorded `viewId`.
_controller.setPlayerView(viewId); _controller.setPlayerView(viewId);
}, },
), ),
......
...@@ -157,6 +157,14 @@ class _DemoTXVodPlayerState extends State<DemoTXVodPlayer> with WidgetsBindingOb ...@@ -157,6 +157,14 @@ class _DemoTXVodPlayerState extends State<DemoTXVodPlayer> with WidgetsBindingOb
child: TXPlayerVideo( child: TXPlayerVideo(
androidRenderType: _renderType, androidRenderType: _renderType,
onRenderViewCreatedListener: (viewId) { onRenderViewCreatedListener: (viewId) {
/// 此处只展示了最基础的纹理和播放器的配置方式。 这里可记录下来 viewId,在多纹理之间进行切换,比如横竖屏切换场景,竖屏的画面,
/// 要切换到横屏的画面,可以在切换到横屏之后,拿到横屏的viewId 设置上去。回到竖屏的时候,再通过 viewId 切换回来。
/// Only the most basic configuration methods for textures and the player are shown here.
/// The `viewId` can be recorded here to switch between multiple textures. For example, in the scenario
/// of switching between portrait and landscape orientations:
/// To switch from the portrait view to the landscape view, obtain the `viewId` of the landscape view
/// after switching to landscape orientation and set it. When switching back to portrait orientation,
/// switch back using the recorded `viewId`.
_controller.setPlayerView(viewId); _controller.setPlayerView(viewId);
}, },
), ),
......
...@@ -74,7 +74,17 @@ class _TXVodPlayerPageState extends State<ShortVideoPageWidget> { ...@@ -74,7 +74,17 @@ class _TXVodPlayerPageState extends State<ShortVideoPageWidget> {
child: Stack( child: Stack(
children: [ children: [
Container( Container(
child: TXPlayerVideo(controller: _controller), child: TXPlayerVideo(onRenderViewCreatedListener: (viewId) {
/// 此处只展示了最基础的纹理和播放器的配置方式。 这里可记录下来 viewId,在多纹理之间进行切换,比如横竖屏切换场景,竖屏的画面,
/// 要切换到横屏的画面,可以在切换到横屏之后,拿到横屏的viewId 设置上去。回到竖屏的时候,再通过 viewId 切换回来。
/// Only the most basic configuration methods for textures and the player are shown here.
/// The `viewId` can be recorded here to switch between multiple textures. For example, in the scenario
/// of switching between portrait and landscape orientations:
/// To switch from the portrait view to the landscape view, obtain the `viewId` of the landscape view
/// after switching to landscape orientation and set it. When switching back to portrait orientation,
/// switch back using the recorded `viewId`.
_controller.setPlayerView(viewId);
},),
), ),
_getPauseView() _getPauseView()
], ],
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# #
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'super_player' s.name = 'super_player'
s.version = '12.4.0' s.version = '12.4.1'
s.summary = 'The super_player Flutter plugin is one of the sub-product SDKs of the audio/video terminal SDK (Tencent Cloud Video on Demand).' s.summary = 'The super_player Flutter plugin is one of the sub-product SDKs of the audio/video terminal SDK (Tencent Cloud Video on Demand).'
s.description = <<-DESC s.description = <<-DESC
player plugin. player plugin.
......
...@@ -2,5 +2,5 @@ ...@@ -2,5 +2,5 @@
part of SuperPlayer; part of SuperPlayer;
abstract class FPlayerPckInfo { abstract class FPlayerPckInfo {
static const String PLAYER_VERSION = "12.4.0"; static const String PLAYER_VERSION = "12.4.1";
} }
\ No newline at end of file
...@@ -5,14 +5,34 @@ typedef FTXOnRenderViewCreatedListener = void Function(int viewId); ...@@ -5,14 +5,34 @@ typedef FTXOnRenderViewCreatedListener = void Function(int viewId);
class TXPlayerVideo extends StatefulWidget { class TXPlayerVideo extends StatefulWidget {
@Deprecated("recommended to use onRenderViewCreatedListener and controller.setPlayerView to bind the video surface.")
final TXPlayerController? controller;
final FTXAndroidRenderViewType renderViewType; final FTXAndroidRenderViewType renderViewType;
final FTXOnRenderViewCreatedListener? onRenderViewCreatedListener; final FTXOnRenderViewCreatedListener? onRenderViewCreatedListener;
///
/// 从 12.4.1 版本开始,移除传入 controller 的绑定纹理方式,该方式由于不可预见问题太多,所以移除。推荐使用 TXPlayerVideo
/// 的 onRenderViewCreatedListener 回调,在获取到 viewId 后,使用 controller#setPlayerView 进行播放器和纹理的绑定
///
/// Starting from version 12.4.1, the method of binding textures by passing in a controller has been removed.
/// This method is removed due to too many unforeseen issues. It is recommended to use the `onRenderViewCreatedListener`
/// callback of `TXPlayerVideo`. After obtaining the `viewId`, use `controller#setPlayerView` to bind the player
/// and texture.
///
/// e.g:
/// TXPlayerVideo(
/// onRenderViewCreatedListener: (viewId) {
/// /// 此处只展示了最基础的纹理和播放器的配置方式。 这里可记录下来 viewId,在多纹理之间进行切换,比如横竖屏切换场景,竖屏的画面,
/// /// 要切换到横屏的画面,可以在切换到横屏之后, 拿到横屏的viewId 设置上去。回到竖屏的时候,再通过 viewId 切换回来。
/// /// Only the most basic configuration methods for textures and the player are shown here.
/// /// The `viewId` can be recorded here to switch between multiple textures. For example, in the scenario
/// /// of switching between portrait and landscape orientations:
/// /// To switch from the portrait view to the landscape view, obtain the `viewId` of the landscape view
/// /// after switching to landscape orientation and set it. When switching back to portrait orientation,
/// /// switch back using the recorded `viewId`.
/// _controller.setPlayerView(viewId);
/// },
/// )
///
TXPlayerVideo({ TXPlayerVideo({
@Deprecated("recommended to use onRenderViewCreatedListener and controller.setPlayerView to bind the video surface.")
this.controller,
this.onRenderViewCreatedListener, this.onRenderViewCreatedListener,
FTXAndroidRenderViewType? androidRenderType, Key? viewKey}) FTXAndroidRenderViewType? androidRenderType, Key? viewKey})
: renderViewType = androidRenderType ?? FTXAndroidRenderViewType.TEXTURE_VIEW, super(key: viewKey); : renderViewType = androidRenderType ?? FTXAndroidRenderViewType.TEXTURE_VIEW, super(key: viewKey);
...@@ -31,39 +51,18 @@ class TXPlayerVideoState extends State<TXPlayerVideo> { ...@@ -31,39 +51,18 @@ class TXPlayerVideoState extends State<TXPlayerVideo> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
if (_viewIdCompleter.isCompleted) {
_setPlayerView(_viewId);
}
} }
@override @override
void didUpdateWidget(covariant TXPlayerVideo oldWidget) { void didUpdateWidget(covariant TXPlayerVideo oldWidget) {
super.didUpdateWidget(oldWidget); super.didUpdateWidget(oldWidget);
if (oldWidget.controller != widget.controller) { if (oldWidget.renderViewType != widget.renderViewType) {
if (_viewIdCompleter.isCompleted) {
setState(() {
_setPlayerView(_viewId);
});
} else {
_waitViewId();
}
} else if (oldWidget.renderViewType != widget.renderViewType) {
setState(() { setState(() {
_platformViewKey = UniqueKey(); _platformViewKey = UniqueKey();
}); });
} }
else {
LogUtils.i(TAG, "met a unchanged widget refresh");
_waitViewId();
}
} }
Future<void> _waitViewId() async {
await _viewIdCompleter.future;
setState(() {
_setPlayerView(_viewId);
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -105,7 +104,6 @@ class TXPlayerVideoState extends State<TXPlayerVideo> { ...@@ -105,7 +104,6 @@ class TXPlayerVideoState extends State<TXPlayerVideo> {
_viewId = params.id; _viewId = params.id;
_viewIdCompleter.complete(params.id); _viewIdCompleter.complete(params.id);
widget.onRenderViewCreatedListener?.call(params.id); widget.onRenderViewCreatedListener?.call(params.id);
_setPlayerView(params.id);
if (widget.renderViewType == FTXAndroidRenderViewType.DRM_SURFACE_VIEW) { if (widget.renderViewType == FTXAndroidRenderViewType.DRM_SURFACE_VIEW) {
return PlatformViewsService.initSurfaceAndroidView( return PlatformViewsService.initSurfaceAndroidView(
id: params.id, id: params.id,
...@@ -135,10 +133,6 @@ class TXPlayerVideoState extends State<TXPlayerVideo> { ...@@ -135,10 +133,6 @@ class TXPlayerVideoState extends State<TXPlayerVideo> {
} }
} }
Future<void> _setPlayerView(int viewId) async {
await widget.controller?.setPlayerView(viewId);
}
void _onCreateIOSView(int id) { void _onCreateIOSView(int id) {
if (_viewIdCompleter.isCompleted) { if (_viewIdCompleter.isCompleted) {
_viewIdCompleter = Completer(); _viewIdCompleter = Completer();
...@@ -146,7 +140,6 @@ class TXPlayerVideoState extends State<TXPlayerVideo> { ...@@ -146,7 +140,6 @@ class TXPlayerVideoState extends State<TXPlayerVideo> {
_viewId = id; _viewId = id;
_viewIdCompleter.complete(id); _viewIdCompleter.complete(id);
widget.onRenderViewCreatedListener?.call(id); widget.onRenderViewCreatedListener?.call(id);
_setPlayerView(id);
} }
Future<int> getViewId() async { Future<int> getViewId() async {
...@@ -154,10 +147,6 @@ class TXPlayerVideoState extends State<TXPlayerVideo> { ...@@ -154,10 +147,6 @@ class TXPlayerVideoState extends State<TXPlayerVideo> {
return _viewId; return _viewId;
} }
void resetController() {
_waitViewId();
}
@override @override
void dispose() { void dispose() {
super.dispose(); super.dispose();
......
name: super_player name: super_player
description: The super_player Flutter plugin is one of the sub-product SDKs of the audio/video terminal SDK (Tencent Cloud Video on Demand). description: The super_player Flutter plugin is one of the sub-product SDKs of the audio/video terminal SDK (Tencent Cloud Video on Demand).
version: 12.4.0 version: 12.4.1
homepage: https://github.com/LiteAVSDK/Player_Flutter homepage: https://github.com/LiteAVSDK/Player_Flutter
environment: environment:
......
...@@ -3,5 +3,5 @@ part of demo_super_player_lib; ...@@ -3,5 +3,5 @@ part of demo_super_player_lib;
class PlayerConstants { class PlayerConstants {
static const PKG_NAME = "superplayer_widget"; static const PKG_NAME = "superplayer_widget";
static const String PLAYER_WIDGET_VERSION = "12.4.0"; static const String PLAYER_WIDGET_VERSION = "12.4.1";
} }
...@@ -375,7 +375,6 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs ...@@ -375,7 +375,6 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs
_videoBottomKey.currentState?.updateUIStatus(SuperPlayerUIStatus.WINDOW_MODE); _videoBottomKey.currentState?.updateUIStatus(SuperPlayerUIStatus.WINDOW_MODE);
_videoTitleKey.currentState?.updateUIStatus(SuperPlayerUIStatus.WINDOW_MODE); _videoTitleKey.currentState?.updateUIStatus(SuperPlayerUIStatus.WINDOW_MODE);
hideControlView(); hideControlView();
_videoKey.currentState?.resetController();
} }
void _refreshDownloadStatus() async { void _refreshDownloadStatus() async {
......
name: superplayer_widget name: superplayer_widget
description: superplayer,base on vodplayer description: superplayer,base on vodplayer
version: 12.4.0 version: 12.4.1
environment: environment:
sdk: '>=2.17.0 <4.0.0' sdk: '>=2.17.0 <4.0.0'
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论