mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-31 08:08:19 +08:00
@@ -16,6 +16,8 @@ import 'package:PiliPlus/utils/storage_pref.dart';
|
|||||||
import 'package:PiliPlus/utils/video_utils.dart';
|
import 'package:PiliPlus/utils/video_utils.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart' show FilteringTextInputFormatter;
|
||||||
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
||||||
|
|
||||||
@@ -149,7 +151,12 @@ List<SettingsModel> get videoSettings => [
|
|||||||
setKey: SettingBoxKey.expandBuffer,
|
setKey: SettingBoxKey.expandBuffer,
|
||||||
defaultVal: false,
|
defaultVal: false,
|
||||||
),
|
),
|
||||||
//video-sync
|
NormalModel(
|
||||||
|
title: '自动同步',
|
||||||
|
leading: const Icon(Icons.sync_rounded),
|
||||||
|
getSubtitle: () => '当前:${Pref.autosync}(此项即mpv的--autosync)',
|
||||||
|
onTap: _showAutoSyncDialog,
|
||||||
|
),
|
||||||
NormalModel(
|
NormalModel(
|
||||||
title: '视频同步',
|
title: '视频同步',
|
||||||
leading: const Icon(Icons.view_timeline_outlined),
|
leading: const Icon(Icons.view_timeline_outlined),
|
||||||
@@ -447,3 +454,43 @@ Future<void> _showHwDecDialog(
|
|||||||
setState();
|
setState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _showAutoSyncDialog(BuildContext context, VoidCallback setState) {
|
||||||
|
String autosync = Pref.autosync.toString();
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => AlertDialog(
|
||||||
|
title: const Text('自动同步'),
|
||||||
|
content: TextFormField(
|
||||||
|
autofocus: true,
|
||||||
|
initialValue: autosync,
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
onChanged: (value) => autosync = value,
|
||||||
|
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: Get.back,
|
||||||
|
child: Text(
|
||||||
|
'取消',
|
||||||
|
style: TextStyle(color: ColorScheme.of(context).outline),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () async {
|
||||||
|
try {
|
||||||
|
// validate
|
||||||
|
int.parse(autosync);
|
||||||
|
Get.back();
|
||||||
|
await GStorage.setting.put(SettingBoxKey.autosync, autosync);
|
||||||
|
setState();
|
||||||
|
} catch (e) {
|
||||||
|
SmartDialog.showToast(e.toString());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: const Text('确定'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@@ -800,7 +800,7 @@ class PlPlayerController {
|
|||||||
}
|
}
|
||||||
// video-sync=display-resample
|
// video-sync=display-resample
|
||||||
await pp.setProperty("video-sync", Pref.videoSync);
|
await pp.setProperty("video-sync", Pref.videoSync);
|
||||||
await pp.setProperty("autosync", "30");
|
await pp.setProperty("autosync", Pref.autosync);
|
||||||
// vo=gpu-next & gpu-context=android & gpu-api=opengl
|
// vo=gpu-next & gpu-context=android & gpu-api=opengl
|
||||||
// await pp.setProperty("vo", "gpu-next");
|
// await pp.setProperty("vo", "gpu-next");
|
||||||
// await pp.setProperty("gpu-context", "android");
|
// await pp.setProperty("gpu-context", "android");
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ abstract final class SettingBoxKey {
|
|||||||
expandBuffer = 'expandBuffer',
|
expandBuffer = 'expandBuffer',
|
||||||
hardwareDecoding = 'hardwareDecoding',
|
hardwareDecoding = 'hardwareDecoding',
|
||||||
videoSync = 'videoSync',
|
videoSync = 'videoSync',
|
||||||
|
autosync = 'autosync',
|
||||||
p1080 = 'p1080',
|
p1080 = 'p1080',
|
||||||
enableAutoEnter = 'enableAutoEnter',
|
enableAutoEnter = 'enableAutoEnter',
|
||||||
enableAutoExit = 'enableAutoExit',
|
enableAutoExit = 'enableAutoExit',
|
||||||
|
|||||||
@@ -252,6 +252,9 @@ abstract final class Pref {
|
|||||||
static String get videoSync =>
|
static String get videoSync =>
|
||||||
_setting.get(SettingBoxKey.videoSync, defaultValue: 'display-resample');
|
_setting.get(SettingBoxKey.videoSync, defaultValue: 'display-resample');
|
||||||
|
|
||||||
|
static String get autosync =>
|
||||||
|
_setting.get(SettingBoxKey.autosync, defaultValue: '30');
|
||||||
|
|
||||||
static CDNService get defaultCDNService {
|
static CDNService get defaultCDNService {
|
||||||
if (_setting.get(SettingBoxKey.CDNService) case final String cdnName) {
|
if (_setting.get(SettingBoxKey.CDNService) case final String cdnName) {
|
||||||
return CDNService.values.byName(cdnName);
|
return CDNService.values.byName(cdnName);
|
||||||
|
|||||||
Reference in New Issue
Block a user