修改播放列表,改为单章播放

This commit is contained in:
rang 2025-10-24 16:54:58 +08:00
parent e44144b229
commit ab3d5f7e02
3 changed files with 109 additions and 62 deletions

View file

@ -13,18 +13,18 @@ class SkipStartEnd {
// StreamController<PlaybackEvent>.broadcast();
SkipStartEnd({required this.start, required this.end, required this.player}) : _index = 0 {
if (start > Duration()) {
_subscriptions.add(
player.currentIndexStream.listen((index) {
if (_index != index && player.position.inMilliseconds < 500) {
Future.microtask(() {
player.seek(start);
});
_index = index!;
}
}),
);
}
// if (start > Duration()) {
// _subscriptions.add(
// player.currentIndexStream.listen((index) {
// if (_index != index && player.position.inMilliseconds < 500) {
// Future.microtask(() {
// player.seek(start);
// });
// _index = index!;
// }
// }),
// );
// }
if (end > Duration()) {
_subscriptions.add(
player.positionStream.distinct().listen((position) {
@ -33,8 +33,9 @@ class SkipStartEnd {
end.inMilliseconds) {
throttler.call(() {
print('跳过片尾');
Future.microtask(() {
throttler.call(player.seekToNext);
Future.microtask(() async {
await player.stop();
player.seekToNext();
});
});
}