提交 fc750bf3 authored 作者: kongdywang's avatar kongdywang

1. Adjust the layout of the player component demo page.

2. The Picture-in-Picture button icon in Android can be hidden by passing an empty string. 3. Fix an issue with the player component where the player listener remained on the portrait page after entering full-screen mode. Also, optimize the interaction logic of the player component.
上级 3dd282ba
...@@ -17,13 +17,20 @@ buildLog "config success on flutter lib pubspec version" ...@@ -17,13 +17,20 @@ buildLog "config success on flutter lib pubspec version"
buildLog "start config flutter lib code version" buildLog "start config flutter lib code version"
sed -i "" "s/PLAYER_VERSION = \"[0-9.]*\"/PLAYER_VERSION = \"$VERSION_NAME\"/" ../lib/Core/common/common_config.dart sed -i "" "s/PLAYER_VERSION = \"[0-9.]*\"/PLAYER_VERSION = \"$VERSION_NAME\"/" ../lib/Core/common/common_config.dart
buildLog "config success on flutter lib code version" buildLog "config success on flutter lib code version"
buildLog "start config flutter superplayer_widget pubspec version"
sed -i "" "s/version:.*$/version: $VERSION_NAME/" ../superplayer_widget/pubspec.yaml
buildLog "config success on superplayer_widget pubspec version"
buildLog "start config plugin android version" buildLog "start config plugin android version"
sed -i "" "s/playerVersion = \"[0-9.]*\"/playerVersion = \"$VERSION_NAME\"/" ../android/config.gradle sed -i "" "s/playerVersion = \"[0-9.]*\"/playerVersion = \"$VERSION_NAME\"/" ../android/config.gradle
buildLog "config success on plugin android version" buildLog "config success on plugin android version"
buildLog "start config plugin ios version" buildLog "start config plugin ios version"
sed -i "" "s/s.version = '[0-9.]*'/s.version = '$VERSION_NAME'/" ../ios/super_player.podspec sed -i "" "s/s.version = '[0-9.]*'/s.version = '$VERSION_NAME'/" ../ios/super_player.podspec
buildLog "config success on plugin ios version" buildLog "config success on plugin ios version"
buildLog "config Version=${VERSION_NAME} done" #buildLog "start config flutter superplayer_widget pubspec version"
\ No newline at end of file #sed -i "" "s/version:.*$/version: $VERSION_NAME/" ../superplayer_widget/pubspec.yaml
#buildLog "config success on superplayer_widget pubspec version"
buildLog "start config playerWidget pubspec version"
sed -i "" "s/version:.*$/version: $VERSION_NAME/" ../../FlutterWidget/superplayer_widget/pubspec.yaml
buildLog "config success on playerWidget pubspec version"
buildLog "start config playerWidget config version"
sed -i "" "s/PLAYER_WIDGET_VERSION = \"[0-9.]*\"/PLAYER_WIDGET_VERSION = \"$VERSION_NAME\"/" ../../FlutterWidget/superplayer_widget/lib/common/player_constants.dart
buildLog "config success on playerWidget config version"
buildLog "config Version=${VERSION_NAME} done"
...@@ -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.3.2' playerVersion = "12.3.2"
compat = "androidx.appcompat:appcompat:1.6.1" compat = "androidx.appcompat:appcompat:1.6.1"
/** /**
......
...@@ -325,9 +325,12 @@ public class FTXPIPManager implements TXSimpleEventBus.EventSubscriber, FtxMessa ...@@ -325,9 +325,12 @@ public class FTXPIPManager implements TXSimpleEventBus.EventSubscriber, FtxMessa
* 播放器id * 播放器id
*/ */
public PipParams(String mPlayBackAssetPath, String mPlayResumeAssetPath, String mPlayPauseAssetPath, public PipParams(String mPlayBackAssetPath, String mPlayResumeAssetPath, String mPlayPauseAssetPath,
String mPlayForwardAssetPath, int mCurrentPlayerId) { String mPlayForwardAssetPath, int mCurrentPlayerId) {
this(mPlayBackAssetPath, mPlayResumeAssetPath, mPlayPauseAssetPath, mPlayForwardAssetPath, this(mPlayBackAssetPath, mPlayResumeAssetPath, mPlayPauseAssetPath, mPlayForwardAssetPath,
mCurrentPlayerId, true, true, true); mCurrentPlayerId, !TXCommonUtil.isBlankStr(mPlayBackAssetPath),
!TXCommonUtil.isBlankStr(mPlayForwardAssetPath)
, !TXCommonUtil.isBlankStr(mPlayResumeAssetPath)
&& !TXCommonUtil.isBlankStr(mPlayPauseAssetPath));
} }
public PipParams(String mPlayBackAssetPath, String mPlayResumeAssetPath, String mPlayPauseAssetPath, public PipParams(String mPlayBackAssetPath, String mPlayResumeAssetPath, String mPlayPauseAssetPath,
...@@ -403,7 +406,7 @@ public class FTXPIPManager implements TXSimpleEventBus.EventSubscriber, FtxMessa ...@@ -403,7 +406,7 @@ public class FTXPIPManager implements TXSimpleEventBus.EventSubscriber, FtxMessa
return mViewHeight; return mViewHeight;
} }
private AtomicInteger a = new AtomicInteger(); private final AtomicInteger mActionIdGenerator = new AtomicInteger();
/** /**
* Construct PIP parameters. * Construct PIP parameters.
...@@ -435,7 +438,7 @@ public class FTXPIPManager implements TXSimpleEventBus.EventSubscriber, FtxMessa ...@@ -435,7 +438,7 @@ public class FTXPIPManager implements TXSimpleEventBus.EventSubscriber, FtxMessa
.putExtras(playOrPauseData) .putExtras(playOrPauseData)
.setPackage(activity.getPackageName()); .setPackage(activity.getPackageName());
Icon playIcon = mIsPlaying ? getPauseIcon(activity) : getPlayIcon(activity); Icon playIcon = mIsPlaying ? getPauseIcon(activity) : getPlayIcon(activity);
PendingIntent playIntent = PendingIntent.getBroadcast(activity, a.incrementAndGet(), PendingIntent playIntent = PendingIntent.getBroadcast(activity, mActionIdGenerator.incrementAndGet(),
playOrPauseIntent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE); playOrPauseIntent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE);
RemoteAction playOrPauseAction = new RemoteAction(playIcon, "playOrPause", "play Or Pause", playIntent); RemoteAction playOrPauseAction = new RemoteAction(playIcon, "playOrPause", "play Or Pause", playIntent);
actions.add(playOrPauseAction); actions.add(playOrPauseAction);
......
...@@ -167,4 +167,11 @@ public class TXCommonUtil { ...@@ -167,4 +167,11 @@ public class TXCommonUtil {
msg.setValue(value); msg.setValue(value);
return msg; return msg;
} }
public static boolean isBlankStr(String value) {
if (null == value) {
return false;
}
return value.trim().isEmpty();
}
} }
...@@ -172,17 +172,18 @@ class _DemoSuperPlayerState extends State<DemoSuperPlayer> with TXPipPlayerResto ...@@ -172,17 +172,18 @@ class _DemoSuperPlayerState extends State<DemoSuperPlayer> with TXPipPlayerResto
} }
Widget getBody() { Widget getBody() {
return SingleChildScrollView( return Container(
child: LayoutBuilder(builder: (context, constrains) { constraints: BoxConstraints(maxHeight: MediaQuery.of(context).size.height),
return Container( child: Column(
constraints: BoxConstraints( children: [
maxHeight: MediaQuery.of(context).size.height _getPlayArea(),
), Expanded(
child: Column( child: Column(
children: [_getPlayArea(), Expanded(flex: 1, child: _getListArea()), _getAddArea()], mainAxisSize: MainAxisSize.min,
), children: [getTabRow(), _getListArea(), _getAddArea()],
); ))
}), ],
),
); );
} }
...@@ -195,21 +196,14 @@ class _DemoSuperPlayerState extends State<DemoSuperPlayer> with TXPipPlayerResto ...@@ -195,21 +196,14 @@ class _DemoSuperPlayerState extends State<DemoSuperPlayer> with TXPipPlayerResto
} }
Widget _getListArea() { Widget _getListArea() {
return Container( return Expanded(
margin: EdgeInsets.only(top: 10), child: Container(
child: Column( margin: EdgeInsets.only(top: 10),
mainAxisAlignment: MainAxisAlignment.start, child: ListView.builder(
children: [
getTabRow(),
Expanded(
child: ListView.builder(
shrinkWrap: true, shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: videoModels.length, itemCount: videoModels.length,
itemBuilder: (context, i) => _buildVideoItem(videoModels[i]), itemBuilder: (context, i) => _buildVideoItem(videoModels[i]),
)) )));
],
));
} }
Widget _buildVideoItem(SuperPlayerModel playModel) { Widget _buildVideoItem(SuperPlayerModel playModel) {
......
...@@ -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.3.2' s.version = '12.3.2'
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.
......
...@@ -3,4 +3,5 @@ part of demo_super_player_lib; ...@@ -3,4 +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.3.2";
} }
...@@ -30,8 +30,8 @@ class SuperPlayerController { ...@@ -30,8 +30,8 @@ class SuperPlayerController {
TXSubtitleRenderModel? _currentSubtitleRenderModel; TXSubtitleRenderModel? _currentSubtitleRenderModel;
SuperPlayerState playerState = SuperPlayerState.INIT; SuperPlayerState playerState = SuperPlayerState.INIT;
SuperPlayerType playerType = SuperPlayerType.VOD; SuperPlayerType playerType = SuperPlayerType.VOD;
FTXVodPlayConfig _vodConfig = FTXVodPlayConfig(); FTXVodPlayConfig vodConfig = FTXVodPlayConfig();
FTXLivePlayConfig _liveConfig = FTXLivePlayConfig(); FTXLivePlayConfig liveConfig = FTXLivePlayConfig();
StreamSubscription? _vodPlayEventListener; StreamSubscription? _vodPlayEventListener;
StreamSubscription? _vodNetEventListener; StreamSubscription? _vodNetEventListener;
StreamSubscription? _livePlayEventListener; StreamSubscription? _livePlayEventListener;
...@@ -53,6 +53,7 @@ class SuperPlayerController { ...@@ -53,6 +53,7 @@ class SuperPlayerController {
bool _isOpenHWAcceleration = true; bool _isOpenHWAcceleration = true;
int _playerUIStatus = SuperPlayerUIStatus.WINDOW_MODE; int _playerUIStatus = SuperPlayerUIStatus.WINDOW_MODE;
final BuildContext _context; final BuildContext _context;
FullScreenController fullScreenController = FullScreenController();
double currentDuration = 0; double currentDuration = 0;
double videoDuration = 0; double videoDuration = 0;
...@@ -345,6 +346,7 @@ class SuperPlayerController { ...@@ -345,6 +346,7 @@ class SuperPlayerController {
/// 正式版 License 需[购买] /// 正式版 License 需[购买]
/// (https://cloud.tencent.com/document/product/881/74588#.E8.B4.AD.E4.B9.B0.E5.B9.B6.E6.96.B0.E5.BB.BA.E6.AD.A3.E5.BC.8F.E7.89.88-license)。 /// (https://cloud.tencent.com/document/product/881/74588#.E8.B4.AD.E4.B9.B0.E5.B9.B6.E6.96.B0.E5.BB.BA.E6.AD.A3.E5.BC.8F.E7.89.88-license)。
Future<void> playWithModelNeedLicence(SuperPlayerModel videoModel) async { Future<void> playWithModelNeedLicence(SuperPlayerModel videoModel) async {
LogUtils.i(TAG, "widget version:${PlayerConstants.PLAYER_WIDGET_VERSION}");
this.videoModel = videoModel; this.videoModel = videoModel;
_playAction = videoModel.playAction; _playAction = videoModel.playAction;
await stopPlay(); await stopPlay();
...@@ -790,14 +792,14 @@ class SuperPlayerController { ...@@ -790,14 +792,14 @@ class SuperPlayerController {
/// Configure the VOD player. /// Configure the VOD player.
/// 配置点播播放器 /// 配置点播播放器
Future<void> setPlayConfig(FTXVodPlayConfig config) async { Future<void> setPlayConfig(FTXVodPlayConfig config) async {
_vodConfig = config; vodConfig = config;
await _vodPlayerController.setConfig(config); await _vodPlayerController.setConfig(config);
} }
/// Configure the Live player. /// Configure the Live player.
/// 配置直播播放器 /// 配置直播播放器
Future<void> setLiveConfig(FTXLivePlayConfig config) async { Future<void> setLiveConfig(FTXLivePlayConfig config) async {
_liveConfig = config; liveConfig = config;
await _livePlayerController.setConfig(config); await _livePlayerController.setConfig(config);
} }
...@@ -902,3 +904,56 @@ class SuperPlayerController { ...@@ -902,3 +904,56 @@ class SuperPlayerController {
return playerState; return playerState;
} }
} }
class FullScreenController {
bool _isInFullScreenUI = false;
int currentOrientation = TXVodPlayEvent.ORIENTATION_PORTRAIT_UP;
Function? onEnterFullScreenUI;
Function? onExitFullScreenUI;
FullScreenController();
void switchToOrientation(int orientationDirection) {
if (currentOrientation != orientationDirection) {
forceSwitchOrientation(orientationDirection);
}
}
void forceSwitchOrientation(int orientationDirection) {
currentOrientation = orientationDirection;
if (orientationDirection == TXVodPlayEvent.ORIENTATION_PORTRAIT_UP) {
exitFullScreen();
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: SystemUiOverlay.values);
} else if (orientationDirection == TXVodPlayEvent.ORIENTATION_LANDSCAPE_RIGHT) {
enterFullScreen();
SystemChrome.setPreferredOrientations(Platform.isIOS ? [DeviceOrientation.landscapeRight] : [DeviceOrientation.landscapeLeft]);
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive);
} else if (orientationDirection == TXVodPlayEvent.ORIENTATION_PORTRAIT_DOWN) {
} else if (orientationDirection == TXVodPlayEvent.ORIENTATION_LANDSCAPE_LEFT) {
SystemChrome.setPreferredOrientations(Platform.isIOS ? [DeviceOrientation.landscapeLeft] : [DeviceOrientation.landscapeRight]);
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive);
enterFullScreen();
}
}
void enterFullScreen() {
if (!_isInFullScreenUI) {
_isInFullScreenUI = true;
onEnterFullScreenUI?.call();
}
}
void exitFullScreen() {
if (_isInFullScreenUI) {
_isInFullScreenUI = false;
onExitFullScreenUI?.call();
}
}
void setListener(Function enterFullScreen, Function exitFullScreen) {
onExitFullScreenUI = exitFullScreen;
onEnterFullScreenUI = enterFullScreen;
}
}
...@@ -3,7 +3,6 @@ part of demo_super_player_lib; ...@@ -3,7 +3,6 @@ part of demo_super_player_lib;
const topBottomOffset = 0.0; const topBottomOffset = 0.0;
int manualOrientationDirection = TXVodPlayEvent.ORIENTATION_LANDSCAPE_RIGHT; int manualOrientationDirection = TXVodPlayEvent.ORIENTATION_LANDSCAPE_RIGHT;
FullScreenController _fullScreenController = FullScreenController();
/// superPlayer view widget /// superPlayer view widget
class SuperPlayerView extends StatefulWidget { class SuperPlayerView extends StatefulWidget {
...@@ -159,9 +158,10 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs ...@@ -159,9 +158,10 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs
// Do not rotate the screen in picture-in-picture mode. // Do not rotate the screen in picture-in-picture mode.
if (eventCode == TXVodPlayEvent.EVENT_ORIENTATION_CHANGED && !_isFloatingMode) { if (eventCode == TXVodPlayEvent.EVENT_ORIENTATION_CHANGED && !_isFloatingMode) {
int orientation = event[TXVodPlayEvent.EXTRA_NAME_ORIENTATION]; int orientation = event[TXVodPlayEvent.EXTRA_NAME_ORIENTATION];
_fullScreenController.switchToOrientation(orientation); _playController.fullScreenController.switchToOrientation(orientation);
} }
}); });
_registerObserver();
_initPlayerState(); _initPlayerState();
connectPlayerView(); connectPlayerView();
} }
...@@ -268,7 +268,7 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs ...@@ -268,7 +268,7 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs
// onDispose // onDispose
_playController._observer = null; // close observer _playController._observer = null; // close observer
}); });
_fullScreenController.setListener(() async { _playController.fullScreenController.setListener(() async {
// enter full screen // enter full screen
if (null != downloadListener) { if (null != downloadListener) {
DownloadHelper.instance.removeDownloadListener(downloadListener!); DownloadHelper.instance.removeDownloadListener(downloadListener!);
...@@ -285,11 +285,6 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs ...@@ -285,11 +285,6 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs
// exit full screen // exit full screen
// refresh render view // refresh render view
Navigator.of(context).pop(); Navigator.of(context).pop();
_playController._updatePlayerUIStatus(SuperPlayerUIStatus.WINDOW_MODE);
_videoBottomKey.currentState?.updateUIStatus(SuperPlayerUIStatus.WINDOW_MODE);
_videoTitleKey.currentState?.updateUIStatus(SuperPlayerUIStatus.WINDOW_MODE);
hideControlView();
_videoKey.currentState?.resetController();
}); });
WidgetsBinding.instance.removeObserver(this); WidgetsBinding.instance.removeObserver(this);
WidgetsBinding.instance.addObserver(this); WidgetsBinding.instance.addObserver(this);
...@@ -366,16 +361,21 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs ...@@ -366,16 +361,21 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs
void _refreshUI() async { void _refreshUI() async {
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
_updateState(); _restoreToWindowMode();
connectPlayerView(); _registerObserver();
setState(() {
connectPlayerView();
_initPlayerState();
});
}); });
} }
void _updateState() { void _restoreToWindowMode() {
// Refresh the binding of the observer. _playController._updatePlayerUIStatus(SuperPlayerUIStatus.WINDOW_MODE);
_registerObserver(); _videoBottomKey.currentState?.updateUIStatus(SuperPlayerUIStatus.WINDOW_MODE);
_initPlayerState(); _videoTitleKey.currentState?.updateUIStatus(SuperPlayerUIStatus.WINDOW_MODE);
_calculateSize(_playController.videoWidth, _playController.videoHeight); hideControlView();
_videoKey.currentState?.resetController();
} }
void _refreshDownloadStatus() async { void _refreshDownloadStatus() async {
...@@ -395,7 +395,7 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs ...@@ -395,7 +395,7 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs
Orientation currentOrientation = MediaQuery.of(context).orientation; Orientation currentOrientation = MediaQuery.of(context).orientation;
bool isLandscape = currentOrientation == Orientation.landscape; bool isLandscape = currentOrientation == Orientation.landscape;
if (!isLandscape) { if (!isLandscape) {
_fullScreenController.forceSwitchOrientation(manualOrientationDirection); _playController.fullScreenController.forceSwitchOrientation(manualOrientationDirection);
} }
} }
} else if (state == AppLifecycleState.inactive) { } else if (state == AppLifecycleState.inactive) {
...@@ -466,7 +466,7 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs ...@@ -466,7 +466,7 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
_updateState(); _calculateSize(_playController.videoWidth, _playController.videoHeight);
return Center( return Center(
child: widget.renderMode == SuperPlayerRenderMode.ADJUST_RESOLUTION ? child: widget.renderMode == SuperPlayerRenderMode.ADJUST_RESOLUTION ?
IntrinsicHeight( IntrinsicHeight(
...@@ -736,9 +736,9 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs ...@@ -736,9 +736,9 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs
void _handleFullScreen(bool toSwitchFullScreen) { void _handleFullScreen(bool toSwitchFullScreen) {
if (toSwitchFullScreen) { if (toSwitchFullScreen) {
_fullScreenController.switchToOrientation(manualOrientationDirection); _playController.fullScreenController.switchToOrientation(manualOrientationDirection);
} else { } else {
_fullScreenController.switchToOrientation(TXVodPlayEvent.ORIENTATION_PORTRAIT_UP); _playController.fullScreenController.switchToOrientation(TXVodPlayEvent.ORIENTATION_PORTRAIT_UP);
} }
} }
...@@ -901,6 +901,7 @@ class SuperPlayerFullScreenState extends State<SuperPlayerFullScreenView> { ...@@ -901,6 +901,7 @@ class SuperPlayerFullScreenState extends State<SuperPlayerFullScreenView> {
@override @override
void dispose() { void dispose() {
widget._playController.fullScreenController._isInFullScreenUI = false;
widget.controller.onExitFullScreen(); widget.controller.onExitFullScreen();
super.dispose(); super.dispose();
} }
...@@ -911,55 +912,3 @@ class SuperPlayerFullScreenController { ...@@ -911,55 +912,3 @@ class SuperPlayerFullScreenController {
SuperPlayerFullScreenController(this.onExitFullScreen); SuperPlayerFullScreenController(this.onExitFullScreen);
} }
class FullScreenController {
bool _isInFullScreenUI = false;
int currentOrientation = TXVodPlayEvent.ORIENTATION_PORTRAIT_UP;
Function? onEnterFullScreenUI;
Function? onExitFullScreenUI;
FullScreenController();
void switchToOrientation(int orientationDirection) {
if (currentOrientation != orientationDirection) {
forceSwitchOrientation(orientationDirection);
}
}
void forceSwitchOrientation(int orientationDirection) {
currentOrientation = orientationDirection;
if (orientationDirection == TXVodPlayEvent.ORIENTATION_PORTRAIT_UP) {
exitFullScreen();
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: SystemUiOverlay.values);
} else if (orientationDirection == TXVodPlayEvent.ORIENTATION_LANDSCAPE_RIGHT) {
enterFullScreen();
SystemChrome.setPreferredOrientations(Platform.isIOS ? [DeviceOrientation.landscapeRight] : [DeviceOrientation.landscapeLeft]);
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive);
} else if (orientationDirection == TXVodPlayEvent.ORIENTATION_PORTRAIT_DOWN) {
} else if (orientationDirection == TXVodPlayEvent.ORIENTATION_LANDSCAPE_LEFT) {
SystemChrome.setPreferredOrientations(Platform.isIOS ? [DeviceOrientation.landscapeLeft] : [DeviceOrientation.landscapeRight]);
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive);
enterFullScreen();
}
}
void enterFullScreen() {
if (!_isInFullScreenUI) {
_isInFullScreenUI = true;
onEnterFullScreenUI?.call();
}
}
void exitFullScreen() {
if (_isInFullScreenUI) {
_isInFullScreenUI = false;
onExitFullScreenUI?.call();
}
}
void setListener(Function enterFullScreen, Function exitFullScreen) {
onExitFullScreenUI = exitFullScreen;
onEnterFullScreenUI = enterFullScreen;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论