preloadSrc abstract method

Future<void> preloadSrc({
  1. required String src,
  2. required int startPos,
})

Preloads a media resource.

You can call this method to preload a media resource into the playlist. To preload multiple media resources, call this method multiple times. After preloading succeeds, call playPreloadedSrc to play the media resource, or call stop to clear the playlist. Before calling this method, make sure you have successfully called open or openWithMediaSource to open the media resource. The SDK does not support preloading duplicate media resources into the playlist, but supports preloading the currently playing media resource again into the playlist.

  • src Network path of the media resource.
  • startPos Start position (in milliseconds) when playback begins after preloading into the playlist. Set to 0 when preloading a live stream.

Returns When the method call succeeds, there is no return value; when fails, the AgoraRtcException exception is thrown. You need to catch the exception and handle it accordingly. See Error Codes for details and resolution suggestions.

Implementation

Future<void> preloadSrc({required String src, required int startPos});