mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2026-02-18 15:29:35 +00:00
部分优化
This commit is contained in:
parent
f9a49f4473
commit
6b1edcb475
11 changed files with 876 additions and 1058 deletions
|
|
@ -1,20 +1,22 @@
|
|||
import 'package:audio_service/audio_service.dart';
|
||||
import 'package:audio_session/audio_session.dart';
|
||||
import 'package:just_audio_media_kit/just_audio_media_kit.dart';
|
||||
import 'package:riverpod/riverpod.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:vaani/features/player/core/audiobook_player.dart';
|
||||
import 'package:vaani/shared/utils/helper.dart';
|
||||
|
||||
part 'audiobook_player.g.dart';
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
Future<AbsAudioHandler> audioHandlerInit(Ref ref) async {
|
||||
if (Helper.isWindows() || Helper.isLinux()) {
|
||||
// JustAudioMediaKit.ensureInitialized(windows: false);
|
||||
JustAudioMediaKit.ensureInitialized();
|
||||
}
|
||||
// for playing audio on windows, linux
|
||||
JustAudioMediaKit.ensureInitialized();
|
||||
|
||||
final audioService = await AudioService.init(
|
||||
// for configuring how this app will interact with other audio apps
|
||||
final session = await AudioSession.instance;
|
||||
await session.configure(const AudioSessionConfiguration.speech());
|
||||
|
||||
final audioService = AudioService.init(
|
||||
builder: () => AbsAudioHandler(ref),
|
||||
config: const AudioServiceConfig(
|
||||
androidNotificationChannelId: 'dr.blank.vaani.channel.audio',
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ part of 'audiobook_player.dart';
|
|||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
String _$audioHandlerInitHash() => r'6e4662a45c1c6e84aa16436f71ffcfecc3d4bdab';
|
||||
String _$audioHandlerInitHash() => r'13b9d56c8dfde3a40736432ea069c899ef35ae75';
|
||||
|
||||
/// See also [audioHandlerInit].
|
||||
@ProviderFor(audioHandlerInit)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue