Preloads music.
abstract preload(songCode: number, jsonOption?: string): number;
You can call this method to preload music that you want to play. After calling this method successfully, the SDK triggers the callback to report preloading events.
Before calling this method to preload music, you need to call or method and obtain the songCode of the music through the callback that triggered.
Parameters
- jsonOption
-
扩展 JSON 字段。
Agora 会根据你在场景字段(sceneType)传入的应用场景进行收费。 不同的应用场景对应不同的费率,你可以参考 查看详细的计费。
- 1:直播场景:K 歌及背景音乐播放。
- 2:直播场景:背景音乐播放。
- 3:(默认)语聊场景:K 歌。
- 4:语聊场景:背景音乐播放。
- 5:VR 场景:K 歌及背景音乐播放。
示例:
{"sceneType":1}
Returns
- 0: Success.
- < 0: Failure.