WKWebViewConfiguration doesn't work

mmt_timmmt_tim Member ✭✭

I'm trying to enable the allowsInlineMediaPlayback to play HTML 5 content inlined. This doesn't work. The bool is set to true but the WKWebView is still opening videos in a fullscreen video player. Another problem: If I hit play the video plays for about one second and stops again.

Has anyone of you a working example for how to do this? I looked in the Firefox for iOS repository on GitHub to see what the are doing because it works in Firefox. I didn't see anything that I'm doing wrong.

Tagged:

Answers

  • LandLuLandLu Member, Xamarin Team Xamurai

    Add a parameter in your link like:

    wkView.LoadRequest(new NSUrlRequest(new NSUrl("https://yourvideo.mp4?playsinline=1")));
    

    If I hit play the video plays for about one second and stops again.

    What effect do you want to achieve after hitting the play buttons for one second?

  • mmt_timmmt_tim Member ✭✭
    edited November 26

    I can't change the URL because the videos are inside a canvas which is loaded within an iFrame. It works on other Apps using the WKWebView.

    I created a new project and it worked, but after making a release build and archiving it, it doesn't work anymore in release or debug configuration. This is a very strange bug which is stopping us from shipping to our customer.

    Creating the webview within the storyboard and setting the settings there it doesn't work either.

    @LandLu said:
    What effect do you want to achieve after hitting the play buttons for one second?

    If I hit the play button the video should play. What happens in the app: I hit the play button and the video stops automatically after ~1 second.

  • mmt_timmmt_tim Member ✭✭
    edited November 26

    I recreated the code on an native app and it has the same strange problems.

  • LandLuLandLu Member, Xamarin Team Xamurai

    If the issue persists on a native project it could the issue of your webpage.

    It works on other Apps using the WKWebView.

    If these apps are made by others they could add some optimization. It's best to share a sample here to demonstrate the issues you are facing.

  • mmt_timmmt_tim Member ✭✭

    Thank you for answering.

    I think it is a WKWebView problem within the iOS 13 SDK because I got the same strange problems with a native app. Sometimes it works and sometimes it doesn't. I can't really reproduce it.

  • LandLuLandLu Member, Xamarin Team Xamurai

    Ah, if so you could try to raise issues on Apple Forum to seek help from native iOS support.

  • mmt_timmmt_tim Member ✭✭

    Yeah on it, will keep you posted.

Sign In or Register to comment.