mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2026-02-16 14:29:35 +00:00
测试安卓修改app名称
This commit is contained in:
parent
6b1edcb475
commit
6ceeb99d20
19 changed files with 1218 additions and 822 deletions
39
lib/features/player/core/abs_audio_handler.dart
Normal file
39
lib/features/player/core/abs_audio_handler.dart
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import 'package:audio_service/audio_service.dart';
|
||||
import 'package:just_audio/just_audio.dart';
|
||||
|
||||
class AbsAudioHandler extends BaseAudioHandler with QueueHandler, SeekHandler {
|
||||
final AudioPlayer player;
|
||||
|
||||
AbsAudioHandler(this.player);
|
||||
|
||||
// 播放控制方法重写
|
||||
@override
|
||||
Future<void> play() async {
|
||||
await player.play();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> pause() async {
|
||||
await player.pause();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> skipToNext() async {
|
||||
await player.seekToNext();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> skipToPrevious() async {
|
||||
await player.seekToPrevious();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> seek(Duration position) async {
|
||||
await player.seek(position);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> setSpeed(double speed) async {
|
||||
await player.setSpeed(speed);
|
||||
}
|
||||
}
|
||||
5
lib/features/player/core/abs_audio_player.dart
Normal file
5
lib/features/player/core/abs_audio_player.dart
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
// ignore_for_file: public_member_api_docs, sort_constructors_first
|
||||
import 'package:just_audio/just_audio.dart';
|
||||
import 'package:shelfsdk/audiobookshelf_api.dart';
|
||||
|
||||
class AbsAudioPlayer extends AudioPlayer {}
|
||||
|
|
@ -32,6 +32,7 @@ class AbsAudioHandler extends BaseAudioHandler with QueueHandler, SeekHandler {
|
|||
|
||||
final _currentChapterObject = BehaviorSubject<BookChapter?>.seeded(null);
|
||||
AbsAudioHandler(this.ref) {
|
||||
notificationSettings = ref.read(appSettingsProvider).notificationSettings;
|
||||
ref.listen(appSettingsProvider, (a, b) {
|
||||
if (a?.notificationSettings != b.notificationSettings) {
|
||||
notificationSettings = b.notificationSettings;
|
||||
|
|
@ -52,12 +53,12 @@ class AbsAudioHandler extends BaseAudioHandler with QueueHandler, SeekHandler {
|
|||
final chapter = _book?.findChapterAtTime(positionInBook);
|
||||
if (chapter != currentChapter) {
|
||||
if (mediaItem.hasValue && chapter != null) {
|
||||
updateMediaItem(
|
||||
mediaItem.value!.copyWith(
|
||||
duration: chapter.duration,
|
||||
displayTitle: chapter.title,
|
||||
),
|
||||
);
|
||||
// updateMediaItem(
|
||||
// mediaItem.value!.copyWith(
|
||||
// duration: chapter.duration,
|
||||
// displayTitle: chapter.title,
|
||||
// ),
|
||||
// );
|
||||
}
|
||||
_currentChapterObject.sink.add(chapter);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue