openAll method

  1. @override
Future<void> openAll(
  1. List<Media> medias, {
  2. bool? play,
  3. int index = 0,
})
override

Opens a list of Media items as the new playlist, optionally starting at index.

Multi-media counterpart of open. index is clamped to [0, medias.length - 1].

Entries are appended on the core WITHOUT starting playback (mpv's loadfile append never autostarts), then a single playlist-play-index starts directly at index. The entry at position 0 is never loaded, played, or reported as current unless it IS the requested index, so a UI bound to PlaybackState.playlist's index never flashes track 1 before the selected track, and no audio from track 1 leaks out. During the transition the outgoing track keeps playing (or stays parked) until the jump; while entries build up on an idle core the playlist index reports -1 (see Playlist.index).

The call succeeds or fails as a whole. When mpv refuses an entry it throws MpvCommandException, the entries it already added leave the playlist, the track that was playing keeps playing (parked at the end, the playlist is left empty), and the play intent goes back to what it was.

Implementation

@override
Future<void> openAll(List<Media> medias, {bool? play, int index = 0}) =>
    _transport.trackLoad(() => _openAll(medias, play, index));