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

View File

@ -8,13 +8,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.9.0" version: "2.9.0"
audio_session:
dependency: transitive
description:
name: audio_session
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.13"
audioplayers: audioplayers:
dependency: "direct main" dependency: "direct main"
description: description:
@ -170,27 +163,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.6.4" 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: lints:
dependency: transitive dependency: transitive
description: description:
@ -289,13 +261,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.2.4" version: "4.2.4"
rxdart:
dependency: transitive
description:
name: rxdart
url: "https://pub.dartlang.org"
source: hosted
version: "0.27.7"
shared_preferences: shared_preferences:
dependency: "direct main" dependency: "direct main"
description: description:

View File

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