add method

Future<void> add(
  1. AudioSource audioSource
)

(Untested) Appends an AudioSource.

Implementation

Future<void> add(AudioSource audioSource) async {
  final index = children.length;
  children.add(audioSource);
  _shuffleOrder.insert(index, 1);
  if (_player != null) {
    _player!._broadcastSequence();
    await audioSource._setup(_player!);
    await (await _player!._platform).concatenatingInsertAll(
        ConcatenatingInsertAllRequest(
            id: _id,
            index: index,
            children: [audioSource._toMessage()],
            shuffleOrder: List.of(_shuffleOrder.indices)));
  }
}