How to autoplay video within UIWebView

DavaaronDavaaron Member ✭✭
edited March 22 in Xamarin.Forms

Hi,

I use UIWebView for both Android and iOS. The video files are on the local filesystem. Everythings works fine for android.
But for iOS, I have a couple of issues: After migrating to WkWebView, I noticed that it's not capable of loading assets with the file protocol, which is necessary and I rely heavily on it. So I rolled back to UIWebView.
The thing is: I wanna autoplay a video which is muted and plays inline, so I tried:

<video src="path/to/video.mp4" autoplay playsinline muted> </video>
But the video is never shown. Even after a gesture, nothing happens. When I add the attribute "controls", then the video shows up (well, it's black, but at least you can see the controls). When you tap the display, the video starts for at least iOS 11.4.

I found a lot of answers, like this one but I cannot find the properties for the webview.

I'm curious how you guys realize that, because it seems like Safari is kind of broken? According to their documentation, Safari should respect the attributes but it seems like it doesn't, at least not within the Xamarin.Forms platform. When I host the web app on the desktop and browse with Safari to the local host. then it works..

Best Answer

Answers

Sign In or Register to comment.