load method Null safety

Future<Video> load(
  1. String url,
  2. [VideoLoadOptions? videoLoadOptions]
)

Use this method to load a video from a given url. If you don't provide videoLoadOptions the defaultLoadOptions will be used.

Please note that on most mobile devices the load method must be called from an input event like MouseEvent or TouchEvent. The load method will never complete if you call it elsewhere in your code. The same is true for the ResourceManager.addVideo method.

Implementation

static Future<Video> load(String url,
    [VideoLoadOptions? videoLoadOptions]) async {
  final options = videoLoadOptions ?? Video.defaultLoadOptions;
  final loadData = options.loadData;
  final corsEnabled = options.corsEnabled;
  final videoUrls = options.getOptimalVideoUrls(url);
  final videoLoader = VideoLoader(videoUrls, loadData, corsEnabled);
  final videoElement = await videoLoader.done;
  return Video._(videoElement);
}