preloadSrc
Preloads media resources.
virtual int preloadSrc(const char* src, int64_t startPos) = 0;
You can call this method to preload media resources into the playlist. If you need to preload multiple media resources, call this method multiple times. After calling this method, if the onPreloadEvent callback reports the PLAYER_PRELOAD_EVENT_COMPLETE event, the preload is successful; if it reports the PLAYER_PRELOAD_EVENT_ERROR event, the preload failed. After a successful preload, if you want to play the media resource, call playPreloadedSrc; if you want to clear the playlist, call stop.
Note:
- Before calling this method, make sure you have successfully opened the media resource using open or openWithMediaSource.
- Agora does not support preloading duplicate media resources into the playlist. However, you can preload a currently playing media resource again into the playlist.
Parameters
- src
- The URL of the media resource.
- startPos
- The position (in milliseconds) where playback starts after the media resource is preloaded into the playlist.
Note: When preloading live streams, set this parameter to 0.
Return Values
- 0: Success.
- < 0: Failure.