Skip to content

Commit

Permalink
Fix bug in concatenating add/addAll.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanheise committed Oct 4, 2020
1 parent c29ee30 commit b258b5d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions just_audio/lib/just_audio.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1317,14 +1317,13 @@ class ConcatenatingAudioSource extends AudioSource {

/// (Untested) Appends an [AudioSource].
Future<void> add(AudioSource audioSource) async {
final index = children.length;
children.add(audioSource);
_player._broadcastSequence();
if (_player != null) {
await (await _player._platform).concatenatingInsertAll(
ConcatenatingInsertAllRequest(
id: _id,
index: children.length,
children: [audioSource._toMessage()]));
id: _id, index: index, children: [audioSource._toMessage()]));
}
}

Expand All @@ -1341,13 +1340,14 @@ class ConcatenatingAudioSource extends AudioSource {

/// (Untested) Appends multiple [AudioSource]s.
Future<void> addAll(List<AudioSource> children) async {
int index = this.children.length;
this.children.addAll(children);
_player._broadcastSequence();
if (_player != null) {
await (await _player._platform).concatenatingInsertAll(
ConcatenatingInsertAllRequest(
id: _id,
index: this.children.length,
index: index,
children: children.map((child) => child._toMessage()).toList()));
}
}
Expand Down

0 comments on commit b258b5d

Please sign in to comment.