Flutter - 如何自动点击屏幕中间 WebView 内的按钮?
Flutter - How to tap automatically a button inside a WebView in the middle of screen?
我正在使用 webview_flutter 插件加载嵌入视频 url,视频加载后我需要在屏幕中间自动点击,以模拟自动播放,因为主机我我正在使用不支持它 (iframe)。
return Container(
color: Colors.black,
width: getWidth(context),
height: getHeight(context),
alignment: Alignment.center,
child: WebView(
initialUrl: Uri.dataFromString(uri, mimeType: 'text/html').toString(),
javascriptMode: JavascriptMode.unrestricted,
),
);
您可以通过default/automatically播放。
使用这个插件:flutter_webview_plugin: ^0.3.11
.
现在使用 mediaPlaybackRequiresUserGesture: false,
自动播放您的视频。
WebviewScaffold(
mediaPlaybackRequiresUserGesture: false,
initialChild: Center(child: CircularProgressIndicator()),
withJavascript: true,
url:'',
),
我正在使用 webview_flutter 插件加载嵌入视频 url,视频加载后我需要在屏幕中间自动点击,以模拟自动播放,因为主机我我正在使用不支持它 (iframe)。
return Container(
color: Colors.black,
width: getWidth(context),
height: getHeight(context),
alignment: Alignment.center,
child: WebView(
initialUrl: Uri.dataFromString(uri, mimeType: 'text/html').toString(),
javascriptMode: JavascriptMode.unrestricted,
),
);
您可以通过default/automatically播放。
使用这个插件:flutter_webview_plugin: ^0.3.11
.
现在使用 mediaPlaybackRequiresUserGesture: false,
自动播放您的视频。
WebviewScaffold(
mediaPlaybackRequiresUserGesture: false,
initialChild: Center(child: CircularProgressIndicator()),
withJavascript: true,
url:'',
),