refactor: Switch to just audio for playing sounds
This commit is contained in:
parent
3cd9d3a2b2
commit
5eae299910
7 changed files with 74 additions and 72 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:flutter/foundation.dart';
|
||||
|
||||
import 'package:assets_audio_player/assets_audio_player.dart';
|
||||
import 'package:flutter_ringtone_player/flutter_ringtone_player.dart';
|
||||
import 'package:just_audio/just_audio.dart';
|
||||
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
|
||||
|
|
@ -14,7 +14,7 @@ class UserMediaManager {
|
|||
|
||||
static final UserMediaManager _instance = UserMediaManager._internal();
|
||||
|
||||
AssetsAudioPlayer? _assetsAudioPlayer;
|
||||
AudioPlayer? _assetsAudioPlayer;
|
||||
|
||||
Future<void> startRingingTone() async {
|
||||
if (PlatformInfos.isMobile) {
|
||||
|
|
@ -22,9 +22,9 @@ class UserMediaManager {
|
|||
} else if ((kIsWeb || PlatformInfos.isMacOS) &&
|
||||
_assetsAudioPlayer != null) {
|
||||
const path = 'assets/sounds/phone.ogg';
|
||||
final player = _assetsAudioPlayer = AssetsAudioPlayer.newPlayer();
|
||||
await player.open(Audio(path),
|
||||
autoStart: true, loopMode: LoopMode.playlist);
|
||||
final player = _assetsAudioPlayer = AudioPlayer();
|
||||
player.setAsset(path);
|
||||
player.play();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue