Notalib / nativescript-webview-ext

Nativescript plugin with extended WebView functionality
Apache License 2.0
76 stars 37 forks source link

Setting media parameters for WkWebview #136

Open kschmidt79 opened 2 years ago

kschmidt79 commented 2 years ago

Hi!

I would like to set some media parameters in the web view to enable html5 video playback for example. We are rendering something in this web view which contains html5 videos. But they are not playing, you just get an image preview of the video.

I found this:

https://developer.apple.com/documentation/webkit/wkwebviewconfiguration

For example this two: allowsInlineMediaPlayback https://developer.apple.com/documentation/webkit/wkwebviewconfiguration/1614793-allowsinlinemediaplayback

mediaTypesRequiringUserActionForPlayback https://developer.apple.com/documentation/webkit/wkwebviewconfiguration/1851524-mediatypesrequiringuseractionfor

Is there a possibility to pass this parameters to the webview object? I'm very new to this topic, maybe someone have an idea.

m-abs commented 2 years ago

You might be able to get the configuration object via webview.ios.configuration.

Or this might help. The wkWebViewConfiguration is a protected property on the WebViewExt class for iOS. https://github.com/Notalib/nativescript-webview-ext/blob/master/src/webview-ext.ios.ts#L26

So you could access it, but it is not very pretty.