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