Setup children late-added to a ConcatenatingAudioSource.

This commit is contained in:
Ryan Heise 2020-12-07 21:33:47 +11:00
parent 8d14c97366
commit a864c2f87d
1 changed files with 8 additions and 0 deletions

View File

@ -1278,6 +1278,7 @@ class ConcatenatingAudioSource extends AudioSource {
children.add(audioSource); children.add(audioSource);
if (_player != null) { if (_player != null) {
_player._broadcastSequence(); _player._broadcastSequence();
await audioSource._setup(_player);
await (await _player._platform).concatenatingInsertAll( await (await _player._platform).concatenatingInsertAll(
ConcatenatingInsertAllRequest( ConcatenatingInsertAllRequest(
id: _id, index: index, children: [audioSource._toMessage()])); id: _id, index: index, children: [audioSource._toMessage()]));
@ -1289,6 +1290,7 @@ class ConcatenatingAudioSource extends AudioSource {
children.insert(index, audioSource); children.insert(index, audioSource);
if (_player != null) { if (_player != null) {
_player._broadcastSequence(); _player._broadcastSequence();
await audioSource._setup(_player);
await (await _player._platform).concatenatingInsertAll( await (await _player._platform).concatenatingInsertAll(
ConcatenatingInsertAllRequest( ConcatenatingInsertAllRequest(
id: _id, index: index, children: [audioSource._toMessage()])); id: _id, index: index, children: [audioSource._toMessage()]));
@ -1301,6 +1303,9 @@ class ConcatenatingAudioSource extends AudioSource {
this.children.addAll(children); this.children.addAll(children);
if (_player != null) { if (_player != null) {
_player._broadcastSequence(); _player._broadcastSequence();
for (var child in children) {
await child._setup(_player);
}
await (await _player._platform).concatenatingInsertAll( await (await _player._platform).concatenatingInsertAll(
ConcatenatingInsertAllRequest( ConcatenatingInsertAllRequest(
id: _id, id: _id,
@ -1314,6 +1319,9 @@ class ConcatenatingAudioSource extends AudioSource {
this.children.insertAll(index, children); this.children.insertAll(index, children);
if (_player != null) { if (_player != null) {
_player._broadcastSequence(); _player._broadcastSequence();
for (var child in children) {
await child._setup(_player);
}
await (await _player._platform).concatenatingInsertAll( await (await _player._platform).concatenatingInsertAll(
ConcatenatingInsertAllRequest( ConcatenatingInsertAllRequest(
id: _id, id: _id,