提交 56312ebd authored 作者: kongdywang's avatar kongdywang

1.Flutter player on Android supports live picture-in-picture.

2.Fixed the NullPointerException that occurs when restoring live picture-in-picture on Android.
上级 56a44e10
...@@ -33,6 +33,9 @@ public class TXPipResult implements Parcelable { ...@@ -33,6 +33,9 @@ public class TXPipResult implements Parcelable {
}; };
public Float getPlayTime() { public Float getPlayTime() {
if (null == mPlayTime) {
return 0F;
}
return mPlayTime; return mPlayTime;
} }
......
...@@ -340,9 +340,19 @@ class TXLivePlayerController extends ChangeNotifier implements ValueListenable<T ...@@ -340,9 +340,19 @@ class TXLivePlayerController extends ChangeNotifier implements ValueListenable<T
String? playIconForAndroid, String? playIconForAndroid,
String? pauseIconForAndroid, String? pauseIconForAndroid,
String? forwardIconForAndroid}) async { String? forwardIconForAndroid}) async {
/// live not support if (defaultTargetPlatform == TargetPlatform.android) {
await _initPlayer.future;
IntMsg intMsg = await _livePlayerApi.enterPictureInPictureMode(PipParamsPlayerMsg()
..backIconForAndroid = backIconForAndroid
..playIconForAndroid = playIconForAndroid
..pauseIconForAndroid = pauseIconForAndroid
..forwardIconForAndroid = forwardIconForAndroid
..playerId = _playerId);
return intMsg.value ?? -1;
} else {
return -1; return -1;
} }
}
/// Exit picture-in-picture mode if the player is in picture-in-picture mode. /// Exit picture-in-picture mode if the player is in picture-in-picture mode.
/// ///
......
...@@ -496,8 +496,9 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs ...@@ -496,8 +496,9 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs
Widget _getPipEnterView() { Widget _getPipEnterView() {
return Visibility( return Visibility(
visible: _isShowControlView && visible: _isShowControlView &&
_playController._playerUIStatus == SuperPlayerUIStatus.WINDOW_MODE && _playController._playerUIStatus == SuperPlayerUIStatus.WINDOW_MODE
_playController.playerType == SuperPlayerType.VOD, && (defaultTargetPlatform == TargetPlatform.android
|| _playController.playerType == SuperPlayerType.VOD),
child: Positioned( child: Positioned(
right: 10, right: 10,
top: 0, top: 0,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论