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
This commit is contained in:
ifsnow
2018-12-04 20:43:38 -08:00
committed by Facebook Github Bot
parent 9facd81894
commit c45d290b07

View File

@@ -78,7 +78,9 @@ static NSURLCredential* clientAuthenticationCredential;
wkWebViewConfig.mediaTypesRequiringUserActionForPlayback = _mediaPlaybackRequiresUserAction
? WKAudiovisualMediaTypeAll
: WKAudiovisualMediaTypeNone;
wkWebViewConfig.dataDetectorTypes = _dataDetectorTypes;
wkWebViewConfig.dataDetectorTypes = _dataDetectorTypes;
#else
wkWebViewConfig.mediaPlaybackRequiresUserAction = _mediaPlaybackRequiresUserAction;
#endif
_webView = [[WKWebView alloc] initWithFrame:self.bounds configuration: wkWebViewConfig];