Changed stop to dispose and removed just_audio

main
Parricc35 2023-02-20 11:05:32 +01:00
parent f38b2fd903
commit 878521325e
3 changed files with 7 additions and 41 deletions

View File

@ -50,9 +50,11 @@ class _IntervalTimerPageState extends State<IntervalTimerPage> {
}
void _resetTimer() {
coolDownPlayer.stop();
highIntensityPlayer.stop();
lowIntensityPlayer.stop();
() async {
await coolDownPlayer.dispose();
await highIntensityPlayer.dispose();
await lowIntensityPlayer.dispose();
}();
_isPaused = true;
_timer?.cancel();
_currentBlock = 0;
@ -67,7 +69,7 @@ class _IntervalTimerPageState extends State<IntervalTimerPage> {
}
Future<void> _playLowIntensityMusic() async {
await highIntensityPlayer.stop();
await highIntensityPlayer.dispose();
Future.delayed(const Duration(microseconds: 600)).then((value) async {
await lowIntensityPlayer.play(UrlSource('assets/workout.mp3'));
});
@ -103,7 +105,7 @@ class _IntervalTimerPageState extends State<IntervalTimerPage> {
_currentBlock++;
_currentDuration = _cooldownDuration;
() async {
await lowIntensityPlayer.stop();
await lowIntensityPlayer.dispose();
await coolDownPlayer.play(UrlSource('assets/cool_down.mp3'));
}();
} else {

View File

@ -8,13 +8,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.9.0"
audio_session:
dependency: transitive
description:
name: audio_session
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.13"
audioplayers:
dependency: "direct main"
description:
@ -170,27 +163,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.4"
just_audio:
dependency: "direct main"
description:
name: just_audio
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.31"
just_audio_platform_interface:
dependency: transitive
description:
name: just_audio_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "4.2.0"
just_audio_web:
dependency: transitive
description:
name: just_audio_web
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.7"
lints:
dependency: transitive
description:
@ -289,13 +261,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "4.2.4"
rxdart:
dependency: transitive
description:
name: rxdart
url: "https://pub.dartlang.org"
source: hosted
version: "0.27.7"
shared_preferences:
dependency: "direct main"
description:

View File

@ -37,7 +37,6 @@ dependencies:
cupertino_icons: ^1.0.2
shared_preferences: ^2.0.17
audioplayers: ^3.0.1
just_audio: ^0.9.31
dev_dependencies:
flutter_test: