open abstract method

Future<int?> open({
  1. required String filePath,
  2. MediaPlayerConfig config = const MediaPlayerConfig(),
})

Open the audio file.
You can only open one audio file with one player instance at the same time. For multiple audio files at the same time, create multiple player instances.

filePath: Audio file paths.
URL of online file, URI of local file, full path to local file, or path to local file starting with /assets/ are supported. For URL of online file, only the https protocol is supported.
Recommended sample rate for audio effect files: 8KHz、16KHz、22.05KHz、44.1KHz、48KHz.
Local audio effect file formats supported by different platforms:

mp3mp4aacm4a3gpwavoggtswma
AndroidYYYYYYY
iOS/macOSYYYYYY
WindowsYYYYYYYY
Online audio effect file formats supported by different platforms:
mp3mp4aacm4a3gpwavoggtswma
AndroidYYYYY
iOS/macOSYYYY
WindowsYYYYYYY

config: Player configuration.

Return value:

  • 0: Success.
  • <0: Failure.

Implementation

Future<int?> open({
  required String filePath,
  MediaPlayerConfig config = const MediaPlayerConfig(),
});