我在flutter应用程序中使用的是webview_flutter:^ 1.0.0程序包,但出现以下警告:
E / libEGL(16177):在没有当前上下文的情况下调用OpenGL ES API(每个线程记录一次) I / chromium(16177):[INFO:CONSOLE(0)]“拒绝加载图像'android-webview-video-poster:default_video_poster / -1319672160645029230',因为它违反了以下内容安全策略指令:“ img-src”自我数据:https://i.vimeocdn.com https://secure-b.vimeocdn.com https://f.vimeocdn.com https://vimeo.com https://secure.gravatar.com https://i0.wp.com https://i1.wp.com https://i2.wp.com https://pagead2.googlesyndication.com { {3}} https://*.ci.vimeows.com https://f.vimeocdn.com”。 I / chromium(16177):“,来源:https://player.vimeo.com(0)
这是我的代码:
class WebViewVideoPlayerWidget extends StatefulWidget {
static const routName = '/vimeoPlayerWidget-page';
@override
_WebViewVideoPlayerWidgetState createState() => _WebViewVideoPlayerWidgetState();
}
class _WebViewVideoPlayerWidgetState extends State<WebViewVideoPlayerWidget> {
@override
void initState() {
AutoOrientation.landscapeAutoMode();
super.initState();
if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView();
}
String iframeUrl = "https://player.vimeo.com/video/462891972";
@override
Widget build(BuildContext context) {
final length = MediaQuery.of(context).size;
SystemChrome.setEnabledSystemUIOverlays ([]);
return Scaffold(
body: Container(
height: length.height,
width: length.width,
child: WebView(
javascriptMode: JavascriptMode.unrestricted,
initialUrl: iframeUrl,
),
),
);
}
@override
void dispose() {
AutoOrientation.landscapeAutoMode();
AutoOrientation.portraitUpMode();
super.dispose();
}
}
如何解决该错误?