Skip to content

Commit 8ce7fff

Browse files
committed
audio fixes
1 parent 0f5ddf0 commit 8ce7fff

File tree

2 files changed

+15
-23
lines changed

2 files changed

+15
-23
lines changed

lib/main.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ import 'package:retune/util.dart';
1111
AudioPlayerHandler? audioHandler;
1212
Future<void> main() async {
1313
WidgetsFlutterBinding.ensureInitialized();
14-
SystemChrome.setSystemUIOverlayStyle(
15-
SystemUiOverlayStyle(statusBarColor: Colors.transparent),
16-
);
17-
await HiveService.init();
1814
audioHandler = await AudioService.init(
1915
builder: () => AudioPlayerHandler(),
2016
config: const AudioServiceConfig(
@@ -24,6 +20,10 @@ Future<void> main() async {
2420
androidShowNotificationBadge: true,
2521
),
2622
);
23+
SystemChrome.setSystemUIOverlayStyle(
24+
SystemUiOverlayStyle(statusBarColor: Colors.transparent),
25+
);
26+
await HiveService.init();
2727

2828
runApp(const MainApp());
2929
}

lib/services/audio_handler_service.dart

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ class AudioPlayerHandler extends BaseAudioHandler with SeekHandler {
1616
playbackState.value.copyWith(
1717
playing: true,
1818
controls: [
19-
MediaControl.skipToPrevious,
2019
MediaControl.pause,
21-
MediaControl.skipToNext,
2220
],
2321
processingState: AudioProcessingState.ready,
2422
),
@@ -29,9 +27,7 @@ class AudioPlayerHandler extends BaseAudioHandler with SeekHandler {
2927
playbackState.value.copyWith(
3028
playing: false,
3129
controls: [
32-
MediaControl.skipToPrevious,
3330
MediaControl.play,
34-
MediaControl.skipToNext,
3531
],
3632
processingState: AudioProcessingState.ready,
3733
),
@@ -62,9 +58,7 @@ class AudioPlayerHandler extends BaseAudioHandler with SeekHandler {
6258
playbackState.add(
6359
playbackState.value.copyWith(
6460
controls: [
65-
MediaControl.skipToPrevious,
6661
MediaControl.play,
67-
MediaControl.skipToNext,
6862
],
6963
processingState: AudioProcessingState.idle,
7064
),
@@ -87,9 +81,7 @@ class AudioPlayerHandler extends BaseAudioHandler with SeekHandler {
8781
playbackState.value.copyWith(
8882
playing: true,
8983
controls: [
90-
MediaControl.skipToPrevious,
9184
MediaControl.pause,
92-
MediaControl.skipToNext,
9385
],
9486
processingState: AudioProcessingState.ready,
9587
),
@@ -124,17 +116,17 @@ class AudioPlayerHandler extends BaseAudioHandler with SeekHandler {
124116
await _audioPlayer.seek(position);
125117
}
126118

127-
@override
128-
Future<void> skipToNext() async {
129-
// This will be handled by PlayerProvider
130-
await super.skipToNext();
131-
}
132-
133-
@override
134-
Future<void> skipToPrevious() async {
135-
// This will be handled by PlayerProvider
136-
await super.skipToPrevious();
137-
}
119+
// @override
120+
// Future<void> skipToNext() async {
121+
// // This will be handled by PlayerProvider
122+
// await super.skipToNext();
123+
// }
124+
125+
// @override
126+
// Future<void> skipToPrevious() async {
127+
// // This will be handled by PlayerProvider
128+
// await super.skipToPrevious();
129+
// }
138130

139131
Future<void> setVolume(double volume) async {
140132
await _audioPlayer.setVolume(volume);

0 commit comments

Comments
 (0)