From a494dabcfbf0e362dec202844c501ea0c9aa22fc Mon Sep 17 00:00:00 2001 From: Ryan Heise Date: Wed, 5 Aug 2020 03:58:43 +1000 Subject: [PATCH] Play interrupts previous future. --- .../src/main/java/com/ryanheise/just_audio/AudioPlayer.java | 5 ++--- lib/just_audio.dart | 5 +++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/android/src/main/java/com/ryanheise/just_audio/AudioPlayer.java b/android/src/main/java/com/ryanheise/just_audio/AudioPlayer.java index fec11db..815ebd1 100644 --- a/android/src/main/java/com/ryanheise/just_audio/AudioPlayer.java +++ b/android/src/main/java/com/ryanheise/just_audio/AudioPlayer.java @@ -605,10 +605,9 @@ public class AudioPlayer implements MethodCallHandler, Player.EventListener, Met public void play(Result result) { if (player.getPlayWhenReady()) return; if (playResult != null) { - result.success(null); - } else { - playResult = result; + playResult.success(null); } + playResult = result; startWatchingBuffer(); player.setPlayWhenReady(true); if (processingState == ProcessingState.completed && playResult != null) { diff --git a/lib/just_audio.dart b/lib/just_audio.dart index a448b1a..d560a1a 100644 --- a/lib/just_audio.dart +++ b/lib/just_audio.dart @@ -1181,8 +1181,9 @@ class ClippingAudioSource extends IndexedAudioSource { }; } -// An [AudioSource] that loops a nested [AudioSource] a -// specified number of times. +// An [AudioSource] that loops a nested [AudioSource] a finite number of times. +// Note that this can be inefficient when using a large loop count. If you wish +// to loop an infinite number of times, use [AudioPlayer.setLoopMode]. class LoopingAudioSource extends AudioSource { AudioSource child; final int count;