setMediaDataLoaderDelegate static method

Future<void> setMediaDataLoaderDelegate(
  1. TTVideoEngineMediaDataLoaderDelegate delegate
)

Implementation

static Future<void> setMediaDataLoaderDelegate(TTVideoEngineMediaDataLoaderDelegate delegate) async {
  if (!_mdlDelegates.contains(delegate)) {
    _mdlDelegates.add(delegate);
  }

  if (_downloadEventChannel == null) {
    _downloadEventChannel = const EventChannel('com.vevideoengine.preloadDelegate.eventchannel');
    _downloadMethodChannel = const MethodChannel('com.vevideoengine.preloadDelegate.methodchannel');
    _downloadEventChannel!.receiveBroadcastStream().listen(_onEvent, onError: _onError);
  }

  await _downloadMethodChannel!.invokeMethod<void>('ls_setPreloadDelegate');
}