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';

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(),
  ));
}
