minor refactoring / cleaning

This commit is contained in:
2024-09-19 20:49:12 -04:00
parent 137f31c104
commit 04873f1240
3 changed files with 76 additions and 16 deletions

View File

@@ -17,6 +17,36 @@ Future<void> setupListenHandler() async {
_session = await AudioSession.instance;
await _session.configure(const AudioSessionConfiguration.music());
//TODO: Do I need to handle these events? audioplayers may be doing it already
//_session.interruptionEventStream.listen((event) {
// if (event.begin) {
// switch (event.type) {
// case AudioInterruptionType.duck:
// _listenHandler.duck();
// break;
// case AudioInterruptionType.pause:
// case AudioInterruptionType.unknown:
// _listenHandler.pause();
// break;
// }
// } else {
// switch (event.type) {
// case AudioInterruptionType.duck:
// _listenHandler.unDuck();
// break;
// case AudioInterruptionType.pause:
// _listenHandler.play();
// break;
// case AudioInterruptionType.unknown:
// break;
// }
// }
//});
//_session.becomingNoisyEventStream.listen((_) {
// _listenHandler.pause();
//});
}
ListenHandler getListenHandlder() => _listenHandler;