我正在使用视频播放器插件-plugin link
同样的代码适用于android,但不适用于web。
void initState() {
super.initState();
_controller = VideoPlayerController.network(
'videourl.m3u8',
formatHint: VideoFormat.hls,
);
_controller.addListener(() {
setState(() {});
});
_controller.setLooping(false);
_controller.initialize();
}
我得到的确切错误是这样的:
Uncaught (in promise) Error: PlatformException(MEDIA_ERR_SRC_NOT_SUPPORTED, No further diagnostic information can be determined or provided., The video has been found to be unsuitable (missing or in a format not supported by your browser)., null)
at Object.createErrorWithStack (errors.dart:284)
at Object._rethrow (async_patch.dart:200)
at async._AsyncCallbackEntry.new.callback (zone.dart:1413)
at Object._microtaskLoop (schedule_microtask.dart:40)
at _startMicrotaskLoop (schedule_microtask.dart:49)
at async_patch.dart:166
我是否需要在这里添加任何额外的信息,使其适用于Web?
1条答案
按热度按时间wi3ka0sx1#
在flutter项目目录/web/index.html中的index.html文件中添加以下代码行