mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: sync flip/onlyPlayAudio from orz12/main
Closes #100 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -81,7 +81,13 @@ class PlPlayerController {
|
||||
late StreamSubscription<DataStatus> _dataListenerForEnterFullscreen;
|
||||
|
||||
/// 后台播放
|
||||
final Rx<bool> _continuePlayInBackground = false.obs;
|
||||
late final Rx<bool> _continuePlayInBackground = false.obs;
|
||||
|
||||
late final Rx<bool> _onlyPlayAudio = false.obs;
|
||||
|
||||
late final Rx<bool> _flipX = false.obs;
|
||||
|
||||
late final Rx<bool> _flipY = false.obs;
|
||||
|
||||
///
|
||||
final Rx<bool> _isSliderMoving = false.obs;
|
||||
@@ -212,6 +218,14 @@ class PlPlayerController {
|
||||
/// 后台播放
|
||||
Rx<bool> get continuePlayInBackground => _continuePlayInBackground;
|
||||
|
||||
/// 听视频
|
||||
Rx<bool> get onlyPlayAudio => _onlyPlayAudio;
|
||||
|
||||
/// 镜像
|
||||
Rx<bool> get flipX => _flipX;
|
||||
|
||||
Rx<bool> get flipY => _flipY;
|
||||
|
||||
/// 是否长按倍速
|
||||
Rx<bool> get doubleSpeedStatus => _doubleSpeedStatus;
|
||||
|
||||
@@ -1429,4 +1443,16 @@ class PlPlayerController {
|
||||
_instance?._playerCount.value -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
void setContinuePlayInBackground() {
|
||||
_continuePlayInBackground.value = !_continuePlayInBackground.value;
|
||||
setting.put(SettingBoxKey.continuePlayInBackground,
|
||||
_continuePlayInBackground.value);
|
||||
}
|
||||
|
||||
void setOnlyPlayAudio() {
|
||||
_onlyPlayAudio.value = !_onlyPlayAudio.value;
|
||||
videoPlayerController?.setVideoTrack(
|
||||
_onlyPlayAudio.value ? VideoTrack.no() : VideoTrack.auto());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -712,17 +712,21 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
_initialFocalPoint = Offset.zero;
|
||||
_gestureType = null;
|
||||
},
|
||||
child: Video(
|
||||
key: plPlayerController.key,
|
||||
controller: videoController,
|
||||
controls: NoVideoControls,
|
||||
pauseUponEnteringBackgroundMode:
|
||||
!plPlayerController.continuePlayInBackground.value,
|
||||
resumeUponEnteringForegroundMode: true,
|
||||
// 字幕尺寸调节
|
||||
subtitleViewConfiguration:
|
||||
plPlayerController.subtitleViewConfiguration,
|
||||
fit: plPlayerController.videoFit.value,
|
||||
child: Transform.flip(
|
||||
flipX: plPlayerController.flipX.value,
|
||||
flipY: plPlayerController.flipY.value,
|
||||
child: Video(
|
||||
key: plPlayerController.key,
|
||||
controller: videoController,
|
||||
controls: NoVideoControls,
|
||||
pauseUponEnteringBackgroundMode:
|
||||
!plPlayerController.continuePlayInBackground.value,
|
||||
resumeUponEnteringForegroundMode: true,
|
||||
// 字幕尺寸调节
|
||||
subtitleViewConfiguration:
|
||||
plPlayerController.subtitleViewConfiguration,
|
||||
fit: plPlayerController.videoFit.value,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user