preloadSrc
Preloads a media resource.
int preloadSrc(String src, long startPos);
After calling this method, if you receive the PLAYER_PRELOAD_EVENT_COMPLETE event in the onPreloadEvent callback, the preload is successful; if you receive the PLAYER_PRELOAD_EVENT_ERROR event, the preload failed. After a successful preload, call playPreloadedSrc to play the media resource. To clear the playlist, call stop().
Note:
- Before calling this method, make sure you have successfully called
openor openWithMediaSource to open the media resource. - Agora does not support preloading the same media resource multiple times into the playlist. However, you can preload a currently playing media resource again into the playlist.
Parameters
- src
- URL of the media resource.
- startPos
- The playback start position (in milliseconds) after the media resource is preloaded into the playlist. Set this parameter to 0 when preloading live streams.
Return Values
- 0: Success.
- < 0: Failure.