preloadMusic method

Future<void> preloadMusic(
  1. AudioMusicParam preloadParam,
  2. TXMusicPreloadObserver? observer
)

Preload background music

You must assign an ID to each music track so that you can start, stop, or set the volume of music tracks by ID.

Parameters:

preloadParam Preload parameter

'observer' For more information, please see the APIs defined in TXMusicPreloadObserver .

Platform not supported:

  • web

Implementation

Future<void> preloadMusic(AudioMusicParam preloadParam, TXMusicPreloadObserver? observer) {
  _listener!.setPreloadObserver(observer);
  return _channel.invokeMethod('preloadMusic', { "preloadParam": jsonEncode(preloadParam), });
}