feat(flutter/player): MinstrelAudioHandler + just_audio + audio_service
audio_service runs the handler in a background isolate; UI watches playbackState/mediaItem/queue streams through Riverpod. AndroidManifest gets the foreground-service media-playback permission; Info.plist gets UIBackgroundModes=audio. Bearer token attached to stream URLs via just_audio's per-source headers.
This commit is contained in:
@@ -1,8 +1,23 @@
|
||||
import 'package:audio_service/audio_service.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import 'app.dart';
|
||||
import 'player/audio_handler.dart';
|
||||
import 'player/player_provider.dart';
|
||||
|
||||
void main() {
|
||||
runApp(const ProviderScope(child: MinstrelApp()));
|
||||
Future<void> main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
final handler = await AudioService.init(
|
||||
builder: () => MinstrelAudioHandler(),
|
||||
config: const AudioServiceConfig(
|
||||
androidNotificationChannelId: 'com.fabledsword.minstrel.audio',
|
||||
androidNotificationChannelName: 'Minstrel playback',
|
||||
androidNotificationOngoing: true,
|
||||
),
|
||||
);
|
||||
runApp(ProviderScope(
|
||||
overrides: [audioHandlerProvider.overrideWithValue(handler)],
|
||||
child: const MinstrelApp(),
|
||||
));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user