Skip to content

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

add forward feature

lauirf0023ae1ea984
diff --git a/lib/pages/player/player_item.dart b/lib/pages/player/player_item.dart
index 9fc07f28..9a9074da 100644
--- a/lib/pages/player/player_item.dart
+++ b/lib/pages/player/player_item.dart
@@ -116,6 +116,9 @@ class _PlayerItemState extends State<PlayerItem>
List<double> playSpeedList = defaultPlaySpeedList;
int episodeNum = 0;
+ late ProgressBar progressBar;
+ int forWardTime = 80;
+
/// 处理 Android/iOS 应用后台或熄屏
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
@@ -1598,8 +1601,9 @@ class _PlayerItemState extends State<PlayerItem>
},
)
: Container(),
+ forwardIcon(),
Expanded(
- child: ProgressBar(
+ child: progressBar = ProgressBar(
timeLabelLocation: TimeLabelLocation.none,
progress: playerController.currentPosition,
buffered: playerController.buffer,
@@ -1761,4 +1765,60 @@ class _PlayerItemState extends State<PlayerItem>
hideTimer = null;
});
}
+
+
+ Widget forwardIcon() {
+ return GestureDetector(
+ onLongPress: () => showForwardChange(),
+ child: IconButton(
+ color: Colors.white,
+ icon: const Icon(Icons.arrow_forward),
+ onPressed: () {
+ progressBar.onSeek!(
+ playerController.currentPosition + Duration(seconds: forWardTime));
+ },
+ ),
+ );
+ }
+ void showForwardChange() {
+ KazumiDialog.show(builder: (context) {
+
+ String input = "";
+ return AlertDialog(
+ title: const Text('跳过秒数'),
+ content: StatefulBuilder(
+ builder: (BuildContext context, StateSetter setState) {
+ return TextField(
+ decoration: InputDecoration(
+ floatingLabelBehavior: FloatingLabelBehavior.never, // 控制label的显示方式
+ labelText: forWardTime.toString(),
+ ),
+ onChanged: (value) {
+ input = value;
+ },
+ );
+ }),
+ actions: <Widget>[
+ TextButton(
+ onPressed: () => KazumiDialog.dismiss(),
+ child: Text(
+ '取消',
+ style: TextStyle(color: Theme.of(context).colorScheme.outline),
+ ),
+ ),
+ TextButton(
+ onPressed: () async {
+ if(Utils.isInt(input)){
+ forWardTime = int.parse(input);
+ KazumiDialog.dismiss();
+ }else{
+ KazumiDialog.showToast(message: "输入不符合");
+ }
+ },
+ child: const Text('确定'),
+ ),
+ ],
+ );
+ });
+ }
}
diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart
index 6ed59056..d40d57c1 100644
--- a/lib/utils/utils.dart
+++ b/lib/utils/utils.dart
@@ -540,4 +540,8 @@ class Utils {
static Future<String> getCurrentDemux() async {
return 'MPV';
}
+
+ static bool isInt(String input) {
+ return int.tryParse(input) != null;
+ }
}