mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2026-02-15 22:09:35 +00:00
30 lines
1.2 KiB
Dart
30 lines
1.2 KiB
Dart
import 'package:audio_service/audio_service.dart';
|
|
import 'package:audio_session/audio_session.dart';
|
|
import 'package:media_kit/media_kit.dart';
|
|
import 'package:vaani/features/player/core/abs_audio_handler.dart' as core;
|
|
|
|
Future<core.AbsAudioHandler> absAudioHandlerInit() async {
|
|
// for playing audio on windows, linux
|
|
MediaKit.ensureInitialized();
|
|
// for configuring how this app will interact with other audio apps
|
|
final session = await AudioSession.instance;
|
|
await session.configure(const AudioSessionConfiguration.speech());
|
|
|
|
final audioService = await AudioService.init(
|
|
builder: () => core.AbsAudioHandler(),
|
|
config: const AudioServiceConfig(
|
|
androidNotificationChannelId: 'dr.blank.vaani.channel.audio',
|
|
androidNotificationChannelName: 'ABSPlayback',
|
|
androidNotificationChannelDescription:
|
|
'Needed to control audio from lock screen',
|
|
androidNotificationOngoing: false,
|
|
androidStopForegroundOnPause: false,
|
|
androidNotificationIcon: 'drawable/ic_stat_logo',
|
|
preloadArtwork: true,
|
|
// fastForwardInterval: Duration(seconds: 20),
|
|
// rewindInterval: Duration(seconds: 20),
|
|
),
|
|
);
|
|
|
|
return audioService;
|
|
}
|