play method

  1. @override
Future<void> play(
  1. String filePath
)
override

Initiates audio playback for the specified file.

This method sends a request to the platform to play the audio file located at the given filePath.

Implementation

@override
Future<void> play(String filePath) async {
  try {
    final path = await _getTempFilePath(filePath);
    await methodChannel.invokeMethod<void>('play', {'filePath': path});
  } on PlatformException catch (e) {
    throw PlatformException(code: e.code, message: e.message);
  }
}