From 37b941cdd1fde71131516f43c5480405c00dc111 Mon Sep 17 00:00:00 2001 From: Crondung <1922635@stud.hs-mannheim.de> Date: Tue, 21 Feb 2023 23:28:31 +0100 Subject: [PATCH 1/2] enable timer to replay music --- lib/pages/interval_page.dart | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/pages/interval_page.dart b/lib/pages/interval_page.dart index 04a0f49..973c269 100644 --- a/lib/pages/interval_page.dart +++ b/lib/pages/interval_page.dart @@ -60,9 +60,9 @@ class _IntervalTimerPageState extends State { void _resetTimer() { () async { - await coolDownPlayer.dispose(); - await warmUpPlayer.dispose(); - await workoutPlayer.dispose(); + await coolDownPlayer.stop(); + await warmUpPlayer.stop(); + await workoutPlayer.stop(); }(); _isPaused = true; _timer?.cancel(); @@ -87,7 +87,7 @@ class _IntervalTimerPageState extends State { } Future _playWorkoutMusic() async { - await warmUpPlayer.dispose(); + await warmUpPlayer.stop(); Future.delayed(const Duration(microseconds: 600)).then((value) async { await workoutPlayer.play(UrlSource('assets/workout.mp3')); }); @@ -123,7 +123,7 @@ class _IntervalTimerPageState extends State { _currentBlock++; _currentDuration = _cooldownDuration; () async { - await workoutPlayer.dispose(); + await workoutPlayer.stop(); await coolDownPlayer.play(UrlSource('assets/cool_down.mp3')); }(); } else { From c0eec7e23dd23304780045ac6e6ff440b5daf6c7 Mon Sep 17 00:00:00 2001 From: Parricc35 <63447810+Parricc35@users.noreply.github.com> Date: Wed, 22 Feb 2023 13:23:17 +0100 Subject: [PATCH 2/2] I dont get it but it is working with loop --- lib/pages/interval_page.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/pages/interval_page.dart b/lib/pages/interval_page.dart index 973c269..3a7eabf 100644 --- a/lib/pages/interval_page.dart +++ b/lib/pages/interval_page.dart @@ -89,6 +89,7 @@ class _IntervalTimerPageState extends State { Future _playWorkoutMusic() async { await warmUpPlayer.stop(); Future.delayed(const Duration(microseconds: 600)).then((value) async { + await workoutPlayer.setReleaseMode(ReleaseMode.loop); await workoutPlayer.play(UrlSource('assets/workout.mp3')); }); } @@ -124,6 +125,7 @@ class _IntervalTimerPageState extends State { _currentDuration = _cooldownDuration; () async { await workoutPlayer.stop(); + await coolDownPlayer.setReleaseMode(ReleaseMode.loop); await coolDownPlayer.play(UrlSource('assets/cool_down.mp3')); }(); } else {