preload static method
- SoundPlayerOptions options
Preloads the sound for faster playback.
Implementation
static Future<void> preload(SoundPlayerOptions options) async {
try {
await _audioPlayer.setSource(UrlSource(options.soundUrl));
} catch (e) {
if (kDebugMode) {
print('Failed to preload sound: $e');
}
}
}