Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ void openUrl(MethodCall call, MethodChannel.Result result) {
boolean withJavascript = call.argument("withJavascript");
boolean clearCache = call.argument("clearCache");
boolean clearCookies = call.argument("clearCookies");
boolean mediaPlaybackRequiresUserGesture = call.argument("mediaPlaybackRequiresUserGesture");
boolean withZoom = call.argument("withZoom");
boolean displayZoomControls = call.argument("displayZoomControls");
boolean withLocalStorage = call.argument("withLocalStorage");
Expand Down Expand Up @@ -144,6 +145,7 @@ void openUrl(MethodCall call, MethodChannel.Result result) {
clearCache,
hidden,
clearCookies,
mediaPlaybackRequiresUserGesture,
userAgent,
url,
headers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ void openUrl(
boolean clearCache,
boolean hidden,
boolean clearCookies,
boolean mediaPlaybackRequiresUserGesture,
String userAgent,
String url,
Map<String, String> headers,
Expand Down Expand Up @@ -384,6 +385,10 @@ void openUrl(

webView.getSettings().setUseWideViewPort(useWideViewPort);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
webView.getSettings().setMediaPlaybackRequiresUserGesture(mediaPlaybackRequiresUserGesture);
}

// Handle debugging
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
webView.setWebContentsDebuggingEnabled(debuggingEnabled);
Expand Down
1 change: 1 addition & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class MyApp extends StatelessWidget {
return WebviewScaffold(
url: selectedUrl,
javascriptChannels: jsChannels,
mediaPlaybackRequiresUserGesture: false,
appBar: AppBar(
title: const Text('Widget WebView'),
),
Expand Down
2 changes: 2 additions & 0 deletions lib/src/base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ class FlutterWebviewPlugin {
bool withJavascript,
bool clearCache,
bool clearCookies,
bool mediaPlaybackRequiresUserGesture,
bool hidden,
bool enableAppScheme,
Rect rect,
Expand All @@ -172,6 +173,7 @@ class FlutterWebviewPlugin {
'clearCache': clearCache ?? false,
'hidden': hidden ?? false,
'clearCookies': clearCookies ?? false,
'mediaPlaybackRequiresUserGesture': mediaPlaybackRequiresUserGesture ?? true,
'enableAppScheme': enableAppScheme ?? true,
'userAgent': userAgent,
'withZoom': withZoom ?? false,
Expand Down
3 changes: 3 additions & 0 deletions lib/src/webview_scaffold.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class WebviewScaffold extends StatefulWidget {
this.withJavascript,
this.clearCache,
this.clearCookies,
this.mediaPlaybackRequiresUserGesture = true,
this.enableAppScheme,
this.userAgent,
this.primary = true,
Expand Down Expand Up @@ -48,6 +49,7 @@ class WebviewScaffold extends StatefulWidget {
final bool withJavascript;
final bool clearCache;
final bool clearCookies;
final bool mediaPlaybackRequiresUserGesture;
final bool enableAppScheme;
final String userAgent;
final bool primary;
Expand Down Expand Up @@ -156,6 +158,7 @@ class _WebviewScaffoldState extends State<WebviewScaffold> {
withJavascript: widget.withJavascript,
clearCache: widget.clearCache,
clearCookies: widget.clearCookies,
mediaPlaybackRequiresUserGesture: widget.mediaPlaybackRequiresUserGesture,
hidden: widget.hidden,
enableAppScheme: widget.enableAppScheme,
userAgent: widget.userAgent,
Expand Down