preload [1/2]
Preloads music resources.
public abstract int preload(long songCode, String jsonOption)
- Deprecated
- This method is deprecated. Use preload [2/2] instead.
After a successful call, the SDK triggers the onPreLoadEvent callback to report preload events. Before calling this method, you need to call getMusicCollectionByMusicChartId or searchMusic to obtain music resources and get the resource identifier (songCode) from the onMusicCollectionResult callback.
Note: Before destroying the RtcEngine object, make sure to call the destroy [2/2] method after receiving the onPreLoadEvent callback.
Parameters
- songCode
- The identifier of the music resource.
- jsonOption
- Extended JSON field. Agora charges based on the
sceneTypeyou set in this field. Different scenes have different billing standards. See the billing documentation.- 1: Live scene: Online karaoke room and background music playback.
- 2: Live scene: Background music playback.
- 3: (Default) Voice chat scene: Online karaoke room.
- 4: Voice chat scene: Background music playback.
- 5: VR scene: Online karaoke room and background music playback.
sceneTypevalue in this field.Example:{"sceneType":1}.
Return Values
- 0: Success.
- < 0: Failure.