mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: 拆分后台播放与AudioService在后台行为的设置
This commit is contained in:
@@ -87,7 +87,7 @@ class PlPlayerController {
|
||||
late StreamSubscription<DataStatus> _dataListenerForEnterFullscreen;
|
||||
|
||||
/// 后台播放
|
||||
final Rx<bool> _backgroundPlay = false.obs;
|
||||
final Rx<bool> _continuePlayInBackground = false.obs;
|
||||
|
||||
///
|
||||
// ignore: prefer_final_fields
|
||||
@@ -209,7 +209,7 @@ class PlPlayerController {
|
||||
Rx<String> get videoFitDEsc => _videoFitDesc;
|
||||
|
||||
/// 后台播放
|
||||
Rx<bool> get backgroundPlay => _backgroundPlay;
|
||||
Rx<bool> get continuePlayInBackground => _continuePlayInBackground;
|
||||
|
||||
/// 是否长按倍速
|
||||
Rx<bool> get doubleSpeedStatus => _doubleSpeedStatus;
|
||||
@@ -311,8 +311,8 @@ class PlPlayerController {
|
||||
enableAutoLongPressSpeed = setting
|
||||
.get(SettingBoxKey.enableAutoLongPressSpeed, defaultValue: false);
|
||||
// 后台播放
|
||||
_backgroundPlay.value =
|
||||
setting.get(SettingBoxKey.enableBackgroundPlay, defaultValue: true);
|
||||
_continuePlayInBackground.value =
|
||||
setting.get(SettingBoxKey.continuePlayInBackground, defaultValue: true);
|
||||
if (!enableAutoLongPressSpeed) {
|
||||
_longPressSpeed.value = videoStorage
|
||||
.get(VideoBoxKey.longPressSpeedDefault, defaultValue: 3.0);
|
||||
@@ -980,8 +980,8 @@ class PlPlayerController {
|
||||
|
||||
/// 设置后台播放
|
||||
Future<void> setBackgroundPlay(bool val) async {
|
||||
_backgroundPlay.value = val;
|
||||
setting.put(SettingBoxKey.enableBackgroundPlay, val);
|
||||
_continuePlayInBackground.value = val;
|
||||
setting.put(SettingBoxKey.continuePlayInBackground, val);
|
||||
videoPlayerServiceHandler.revalidateSetting();
|
||||
}
|
||||
|
||||
|
||||
@@ -496,10 +496,10 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
children: <Widget>[
|
||||
Obx(
|
||||
() => Video(
|
||||
key: ValueKey('${_.videoFit.value}${_.backgroundPlay.value}'),
|
||||
key: ValueKey('${_.videoFit.value}${_.continuePlayInBackground.value}'),
|
||||
controller: videoController,
|
||||
controls: NoVideoControls,
|
||||
pauseUponEnteringBackgroundMode: !_.backgroundPlay.value,
|
||||
pauseUponEnteringBackgroundMode: !_.continuePlayInBackground.value,
|
||||
resumeUponEnteringForegroundMode: true,
|
||||
subtitleViewConfiguration: const SubtitleViewConfiguration(
|
||||
style: subTitleStyle,
|
||||
|
||||
Reference in New Issue
Block a user