open method

  1. @override
Future<void> open(
  1. String uri, {
  2. bool play = true,
})

Opens a media resource by URI and optionally starts playback immediately.

uri is the media resource location (file path, http(s) or hls URL).

play controls whether playback starts right after opening; defaults to implementation-defined behavior when omitted.

Returns a future that completes once the open request has been issued.

通过 URI 打开一个媒体资源,并可选择立即开始播放。

uri 为媒体资源地址(文件路径、http(s) 或 hls 链接)。

play 控制打开后是否立即开始播放;省略时由具体实现决定默认行为。

返回一个在打开请求发出后完成的 Future。

Implementation

@override
Future<void> open(String uri, {bool play = true}) async {
  _cancelScript();
  calls.add('open');
  lastUri = uri;
  lastPlay = play;
  final err = openError;
  if (err != null) throw err;
  if (!_disposed) _startScript(play);
}