setAudioSources method
Implementation
bool setAudioSources(
List<AudioSource> sources, {
int initialIndex = 0,
Duration initialPosition = Duration.zero,
bool useLazyPreparation = true,
Object? shuffleOrder,
}) {
final paths = sources.map((s) => _uriToEnginePath(s.uri)).toList();
final ok = setPlaylist(paths);
if (!ok) return false;
if (sources.isEmpty) return false;
final idx = initialIndex.clamp(0, sources.length - 1);
final jumped = jumpToWithPosition(idx, initialPosition);
if (!useLazyPreparation) {
// Force preload behavior by briefly touching next/prev ordering.
reshuffle();
}
if (shuffleOrder != null) {
// Placeholder to keep API compatibility with caller; shuffle policy remains engine-defined.
}
return jumped;
}