From c45d290b079f95466ad4054acf7b93c66cabc429 Mon Sep 17 00:00:00 2001 From: ifsnow Date: Tue, 4 Dec 2018 20:43:38 -0800 Subject: [PATCH] Fixed for supporting mediaPlaybackRequiresUserAction under iOS 10. (#22208) Summary: There is a problem that the `mediaPlaybackRequiresUserAction` property does not work in WKWebView(`useWebKit`) under iOS 10. I fully know you are currently working to migrate the core's WebView to the standalone `react-native-webview` project. This has already been submitted to PR in `react-native-webview` and will be merged soon. I hope this fix applies to `react-native` before your migration is done. Pull Request resolved: https://github.com/facebook/react-native/pull/22208 Differential Revision: D13334868 Pulled By: cpojer fbshipit-source-id: f2a811a477054155ed5fe62ab31e4d63f70e7848 --- React/Views/RCTWKWebView.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/React/Views/RCTWKWebView.m b/React/Views/RCTWKWebView.m index 79f81df5de0ebd..54c976cf353047 100644 --- a/React/Views/RCTWKWebView.m +++ b/React/Views/RCTWKWebView.m @@ -78,7 +78,9 @@ - (void)didMoveToWindow wkWebViewConfig.mediaTypesRequiringUserActionForPlayback = _mediaPlaybackRequiresUserAction ? WKAudiovisualMediaTypeAll : WKAudiovisualMediaTypeNone; - wkWebViewConfig.dataDetectorTypes = _dataDetectorTypes; + wkWebViewConfig.dataDetectorTypes = _dataDetectorTypes; +#else + wkWebViewConfig.mediaPlaybackRequiresUserAction = _mediaPlaybackRequiresUserAction; #endif _webView = [[WKWebView alloc] initWithFrame:self.bounds configuration: wkWebViewConfig];