load method

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 {
  var options = videoLoadOptions ?? Video.defaultLoadOptions;
  var loadData = options.loadData;
  var corsEnabled = options.corsEnabled;
  var videoUrls = options.getOptimalVideoUrls(url);
  var videoLoader = VideoLoader(videoUrls, loadData, corsEnabled);
  var videoElement = await videoLoader.done;
  return Video._(videoElement);
}