play method
void
play({})
Implementation
void play(
{required Sound sound,
String? customSound,
String? packageName, // Use it only when using other plugin
bool? isLooping = false,
}) async {
String soundPath = "";
if (customSound != null && customSound.isNotEmpty) {
soundPath = customSound;
if (Platform.isAndroid && packageName != null && packageName.isNotEmpty) {
soundPath = soundPath;
}
} else {
soundPath = _getDefaultSoundPath(sound);
packageName ??= UIConstants.packageName;
if (Platform.isAndroid) {
soundPath = "packages/$packageName/$soundPath";
}
}
await UIConstants.channel.invokeMethod("playCustomSound",
{'assetAudioPath': soundPath, 'package': packageName, 'isLooping': isLooping});
}