open method
@detail api
@brief 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.
For audio file in PCM format, see openWithCustomSource:config:{@link #ByteRTCMediaPlayer#openWithCustomSource:config}. openWithCustomSource and this API are mutually exclusive.
@param filePath Audio file paths.
URL of online file, URI of local file, or full path to local file 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:
| mp3 | mp4 | aac | m4a | 3gp | wav | ogg | ts | wma |
| Android | Y | Y | Y | Y | Y | Y | Y | | |
| iOS/macOS | Y | Y | Y | Y | Y | Y | | | |
| Windows | Y | Y | Y | Y | Y | Y | | Y | Y |
Online audio effect file formats supported by different platforms.
| mp3 | mp4 | aac | m4a | 3gp | wav | ogg | ts | wma |
| Android | Y | | Y | Y | Y | Y | | | |
| iOS/macOS | Y | | Y | Y | | Y | | | |
| Windows | Y | | Y | Y | Y | Y | | Y | Y |
@param config See ByteRTCMediaPlayerConfig{@link #ByteRTCMediaPlayerConfig}.
@return
- 0: Success.
- < 0 : Fail. See ByteRTCReturnStatus{@link #ByteRTCReturnStatus} for more details.
Implementation
FutureOr<int> open(NSString filePath, ByteRTCMediaPlayerConfig config) async {
return await nativeCall('open:config:', [filePath, config]);
}