open method

FutureOr<int> open(
  1. NSString filePath,
  2. ByteRTCMediaPlayerConfig config
)

@detail api @brief 打开音乐文件。
一个播放器实例仅能够同时打开一个音乐文件。如果需要同时打开多个音乐文件,请创建多个音乐播放器实例。
要播放 PCM 格式的音频数据,参看 openWithCustomSource:config:{@link #ByteRTCMediaPlayer#openWithCustomSource:config}。openWithCustomSource 和此 API 互斥。 @param filePath 音乐文件路径。
支持在线文件的 URL、本地文件的 URI、或本地文件的绝对路径。对于在线文件的 URL,仅支持 https 协议。
推荐的采样率:8KHz、16KHz、22.05KHz、44.1KHz、48KHz。
不同平台支持的本地文件格式:

mp3mp4aacm4a3gpwavoggtswma
AndroidYYYYYYY
iOS/macOSYYYYYY
WindowsYYYYYYYY
不同平台支持的在线文件格式:
mp3mp4aacm4a3gpwavoggtswma
AndroidYYYYY
iOS/macOSYYYY
WindowsYYYYYYY
@param config 详见 ByteRTCMediaPlayerConfig{@link #ByteRTCMediaPlayerConfig}。 @return - 0: 调用成功。 - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明

Implementation

FutureOr<int> open(NSString filePath, ByteRTCMediaPlayerConfig config) async {
  return await nativeCall('open:config:', [filePath, config]);
}