Skip to content

基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。

fix forward

lauirfcf0669b88e6d
diff --git a/lib/pages/player/player_controller.dart b/lib/pages/player/player_controller.dart
index 49aa651a..44cfa40a 100644
--- a/lib/pages/player/player_controller.dart
+++ b/lib/pages/player/player_controller.dart
@@ -73,6 +73,8 @@ abstract class _PlayerController with Store {
bool lowMemoryMode = false;
bool autoPlay = true;
+ int forwardTime = 80;
+
Future<void> init(String url, {int offset = 0}) async {
videoUrl = url;
playing = false;
@@ -245,4 +247,8 @@ abstract class _PlayerController with Store {
loading = true;
} catch (_) {}
}
+
+ void setForwardTime(int time){
+ forwardTime = time;
+ }
}
diff --git a/lib/pages/player/player_item.dart b/lib/pages/player/player_item.dart
index 9a9074da..e2770198 100644
--- a/lib/pages/player/player_item.dart
+++ b/lib/pages/player/player_item.dart
@@ -117,7 +117,6 @@ class _PlayerItemState extends State<PlayerItem>
int episodeNum = 0;
late ProgressBar progressBar;
- int forWardTime = 80;
/// 处理 Android/iOS 应用后台或熄屏
@override
@@ -1772,17 +1771,16 @@ class _PlayerItemState extends State<PlayerItem>
onLongPress: () => showForwardChange(),
child: IconButton(
color: Colors.white,
- icon: const Icon(Icons.arrow_forward),
+ icon: const Icon(Icons.fast_forward),
onPressed: () {
progressBar.onSeek!(
- playerController.currentPosition + Duration(seconds: forWardTime));
+ playerController.currentPosition + Duration(seconds: playerController.forwardTime));
},
),
);
}
void showForwardChange() {
KazumiDialog.show(builder: (context) {
-
String input = "";
return AlertDialog(
title: const Text('跳过秒数'),
@@ -1791,7 +1789,7 @@ class _PlayerItemState extends State<PlayerItem>
return TextField(
decoration: InputDecoration(
floatingLabelBehavior: FloatingLabelBehavior.never, // 控制label的显示方式
- labelText: forWardTime.toString(),
+ labelText: playerController.forwardTime.toString(),
),
onChanged: (value) {
input = value;
@@ -1808,8 +1806,8 @@ class _PlayerItemState extends State<PlayerItem>
),
TextButton(
onPressed: () async {
- if(Utils.isInt(input)){
- forWardTime = int.parse(input);
+ if (int.tryParse(input) != null) {
+ playerController.setForwardTime(int.parse(input));
KazumiDialog.dismiss();
}else{
KazumiDialog.showToast(message: "输入不符合");
diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart
index d40d57c1..6ed59056 100644
--- a/lib/utils/utils.dart
+++ b/lib/utils/utils.dart
@@ -540,8 +540,4 @@ class Utils {
static Future<String> getCurrentDemux() async {
return 'MPV';
}
-
- static bool isInt(String input) {
- return int.tryParse(input) != null;
- }
}