Start a new topic
Solved

WKWebView, breaking change and exposed deprecated api

Hello to the team (again),


We just bought the last version (8.10) upgrading from the version 8.2 and we are facing a severe limitation.


First, we would like to report the exposure of a deprecated API :

architectView.Start((conf) =>
                {
                    conf.CaptureDevicePosition = AVFoundation.AVCaptureDevicePosition.Back;
                    conf.WebViewAllowsInlineMediaPlayback = true;
                    conf.WebViewMediaPlaybackRequiresUserAction = false;
                });

As per your changelog those parameters have been removed in your SDK, but are still present in the Xamarin plugin and makes the application crash when used.


Directly linked to this is our issue : we have been using this API with the 8.2 version in order to auto-play a vimeo video in HTML over the scanner, but this is not possible anymore with this new version. Also, a workaround such as grasping the WKWebView in the sub view and modifying the configuration is not possible, because the configuration object of WKWebView is read-only. That means that the following :

            foreach (UIView subview in architectView.Subviews)
            {
                    if (subview is WKWebView v)
                    {
                        v.Configuration.AllowsInlineMediaPlayback = true;
                        v.Configuration.RequiresUserActionForMediaPlayback = false;
                        v.Configuration.MediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypes.None;
                    }
            }

 Works on a clone of the Configuration object and thus have no effect.


This configuration must be set when creating the web view, but it seems that there is no way to do this anymore in the 8.10 version. How can we fix this breaking change ?


Many thanks,

Kind regards,



Hello,


This is still an issue and we couldn't find any workaround so far. It's very problematic that the control over the starting parameters of the iOS webview have been deleted in this update, I'm pretty sure we are not the only ones who have been relying on this feature.


All is needed is to be able to modify the WKWebViewConfiguration object before launching the architect world.


Waiting for your assistance,


Kind regards,

Hi Marlène,


The WKWebView in our WTArchitectView allows autoplay by default on our 8.10 release. These are the relevant settings that we have enabled internally for this purpose:

allowsInlineMediaPlayback = YES
mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeNone


It's up to the video HTML tag to enable this by including the autoplay attribute. Does the following line not work for you?

<video autoplay src="yourVideo.mp4" type="video/mp4"/>



- Damian

Hello Damian,


Many thanks for your reply. The autoplay feature does work, but the inline playback doesn't and the video is systematically opened in the native player (which wasn't the case in the 8.2 version with the proper configuration on the web view).


I could confirm that creating my own WKWebView with the following configuration works properly with the exact same html & javascript code :

        private static WKWebViewConfiguration allowAutoPlayConfig = new WKWebViewConfiguration()
        {
            MediaPlaybackRequiresUserAction = false,
            AllowsInlineMediaPlayback = true
        };


Thanks in advance for your help,


Kind regards,

Hi Marlène,


The issue with inline playing was fixed on the 9.0 release, this code snippet should be working for you on that version:


<video autoplay playsinline width="320" height="240">
    <source src="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerEscapes.mp4" type="video/mp4">
</video>


We are aware of the deprecated methods exposed in the Xamarin API, they will be removed in a future version as well.


Hope that helps, sorry for the inconvenience.



- Damian

Login or Signup to post a comment