opt: pip issues #752
This commit is contained in:
@ -99,7 +99,6 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
fullScreenStatusListener();
|
fullScreenStatusListener();
|
||||||
if (Platform.isAndroid) {
|
if (Platform.isAndroid) {
|
||||||
floating = vdCtr.floating!;
|
floating = vdCtr.floating!;
|
||||||
autoEnterPip();
|
|
||||||
}
|
}
|
||||||
WidgetsBinding.instance.addObserver(this);
|
WidgetsBinding.instance.addObserver(this);
|
||||||
lifecycleListener();
|
lifecycleListener();
|
||||||
@ -128,8 +127,9 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 播放器状态监听
|
// 播放器状态监听
|
||||||
void playerListener(PlayerStatus? status) async {
|
void playerListener(PlayerStatus status) async {
|
||||||
playerStatus.value = status!;
|
playerStatus.value = status;
|
||||||
|
autoEnterPip(status: status);
|
||||||
if (status == PlayerStatus.completed) {
|
if (status == PlayerStatus.completed) {
|
||||||
// 结束播放退出全屏
|
// 结束播放退出全屏
|
||||||
if (autoExitFullcreen) {
|
if (autoExitFullcreen) {
|
||||||
@ -181,6 +181,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
plPlayerController!.addStatusLister(playerListener);
|
plPlayerController!.addStatusLister(playerListener);
|
||||||
vdCtr.autoPlay.value = true;
|
vdCtr.autoPlay.value = true;
|
||||||
vdCtr.isShowCover.value = false;
|
vdCtr.isShowCover.value = false;
|
||||||
|
autoEnterPip(status: PlayerStatus.playing);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fullScreenStatusListener() {
|
void fullScreenStatusListener() {
|
||||||
@ -287,10 +288,12 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
.subscribe(this, ModalRoute.of(context)! as PageRoute);
|
.subscribe(this, ModalRoute.of(context)! as PageRoute);
|
||||||
}
|
}
|
||||||
|
|
||||||
void autoEnterPip() {
|
void autoEnterPip({PlayerStatus? status}) {
|
||||||
final String routePath = Get.currentRoute;
|
final String routePath = Get.currentRoute;
|
||||||
if (autoPiP && routePath.startsWith('/video')) {
|
if (autoPiP && routePath.startsWith('/video')) {
|
||||||
floating.toggleAutoPip(autoEnter: autoPiP);
|
floating.toggleAutoPip(
|
||||||
|
autoEnter: autoPiP && status == PlayerStatus.playing,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user