playAudioOnWeb function
Implementation
Future<void> playAudioOnWeb(Uint8List audioBytes) async {
final blob = html.Blob([audioBytes]);
final url = html.Url.createObjectUrlFromBlob(blob);
final AudioPlayer audioPlayer = AudioPlayer(); // Initialize AudioPlayer here
try {
await audioPlayer.play(UrlSource(url));
} catch (e) {
print('Error playing audio on the web: $e');
} finally {
html.Url.revokeObjectUrl(url); // Clean up
}
}