mod: 默认开启后台播放

This commit is contained in:
orz12
2024-04-06 09:31:45 +08:00
parent 3776cfee35
commit b45f8da189
4 changed files with 6 additions and 6 deletions

View File

@@ -135,7 +135,7 @@ class _PlaySettingState extends State<PlaySetting> {
title: '后台播放', title: '后台播放',
subTitle: '进入后台时继续播放', subTitle: '进入后台时继续播放',
setKey: SettingBoxKey.enableBackgroundPlay, setKey: SettingBoxKey.enableBackgroundPlay,
defaultVal: false, defaultVal: true,
), ),
if (Platform.isAndroid) if (Platform.isAndroid)
SetSwitchItem( SetSwitchItem(
@@ -146,7 +146,7 @@ class _PlaySettingState extends State<PlaySetting> {
callFn: (val) { callFn: (val) {
if (val && if (val &&
!setting.get(SettingBoxKey.enableBackgroundPlay, !setting.get(SettingBoxKey.enableBackgroundPlay,
defaultValue: false)) { defaultValue: true)) {
SmartDialog.showToast('建议开启后台播放'); SmartDialog.showToast('建议开启后台播放');
} }
}), }),

View File

@@ -1291,7 +1291,7 @@ class _HeaderControlState extends State<HeaderControl> {
if (canUsePiP) { if (canUsePiP) {
bool enableBackgroundPlay = setting.get( bool enableBackgroundPlay = setting.get(
SettingBoxKey.enableBackgroundPlay, SettingBoxKey.enableBackgroundPlay,
defaultValue: false); defaultValue: true);
if (!enableBackgroundPlay) { if (!enableBackgroundPlay) {
// SmartDialog.showToast('建议开启【后台播放】功能\n避免画中画没有暂停按钮'); // SmartDialog.showToast('建议开启【后台播放】功能\n避免画中画没有暂停按钮');
// await Future.delayed(const Duration(seconds: 2), () { // await Future.delayed(const Duration(seconds: 2), () {

View File

@@ -312,7 +312,7 @@ class PlPlayerController {
.get(SettingBoxKey.enableAutoLongPressSpeed, defaultValue: false); .get(SettingBoxKey.enableAutoLongPressSpeed, defaultValue: false);
// 后台播放 // 后台播放
_backgroundPlay.value = _backgroundPlay.value =
setting.get(SettingBoxKey.enableBackgroundPlay, defaultValue: false); setting.get(SettingBoxKey.enableBackgroundPlay, defaultValue: true);
if (!enableAutoLongPressSpeed) { if (!enableAutoLongPressSpeed) {
_longPressSpeed.value = videoStorage _longPressSpeed.value = videoStorage
.get(VideoBoxKey.longPressSpeedDefault, defaultValue: 3.0); .get(VideoBoxKey.longPressSpeedDefault, defaultValue: 3.0);

View File

@@ -25,7 +25,7 @@ Future<VideoPlayerServiceHandler> initAudioService() async {
class VideoPlayerServiceHandler extends BaseAudioHandler with SeekHandler { class VideoPlayerServiceHandler extends BaseAudioHandler with SeekHandler {
static final List<MediaItem> _item = []; static final List<MediaItem> _item = [];
Box setting = GStrorage.setting; Box setting = GStrorage.setting;
bool enableBackgroundPlay = false; bool enableBackgroundPlay = true;
PlPlayerController player = PlPlayerController.getInstance(); PlPlayerController player = PlPlayerController.getInstance();
VideoPlayerServiceHandler() { VideoPlayerServiceHandler() {
@@ -34,7 +34,7 @@ class VideoPlayerServiceHandler extends BaseAudioHandler with SeekHandler {
revalidateSetting() { revalidateSetting() {
enableBackgroundPlay = enableBackgroundPlay =
setting.get(SettingBoxKey.enableBackgroundPlay, defaultValue: false); setting.get(SettingBoxKey.enableBackgroundPlay, defaultValue: true);
} }
@override @override