playPooled method
Play using a pooled player (or fallback to the single channel player).
Returns a StopFunction when pooling is active; returns null when
falling back to the single player.
key: pool identifier for this sound (defaults to path if you use playPooledPath). All plays with the same key share a pool.source: any audioplayersSource(Asset/DeviceFile/Url/Bytes).volume: defaults to the channel’s currentvolume.
Implementation
Future<StopFunction?> playPooled(
String key,
Source source, {
double? volume,
}) async {
if (!_poolingEnabled) {
await playFromSource(source);
return null;
}
final pool = await _poolFor(key, source);
return pool.start(volume: volume ?? this.volume);
}