play static method

bool play(
  1. String filePath
)

Starts or resumes playing an audio file from the given filePath. Returns true if the playback started successfully.

Implementation

static bool play(String filePath) {
  // Convert Dart String to C-style String
  final ffi.Pointer<Utf8> filePathPtr = filePath.toNativeUtf8();

  // Call Zig native function
  final bool success = _playAudioNative(filePathPtr);

  // Free allocated memory immediately to prevent memory leaks
  calloc.free(filePathPtr);

  if (success) {
    _isPlaying = true;
  }
  return success;
}