Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Video from local storage not playing in WebView (Xamarin.Forms) after latest iOS update (12.2)

I have an existing Xamarin Forms application, for Android and iOS, which shows some HTML content from local storage (the purpose is to view this content while offline) in WebView.

After the latest iOS update (12.2), the videos in that HTML stopped working. White background is shown on the place of the video, with the symbol "Play" but no action is possible.

The problem

I have tried changing the video tag to include autoplay, mute, but no success.

<video width="560" height="315" controls>
<source src="Absolute-3D.mp4" type="video/mp4">
</video>

I expect it to continue working as it was before the update, but something is blocking it.

like image 418
Ana Kochevska Avatar asked Apr 10 '19 15:04

Ana Kochevska


1 Answers

It is a UIWebView bug , I add the below code, it works now.

self.webView.mediaPlaybackRequiresUserAction = NO;
self.webView.allowsPictureInPictureMediaPlayback = YES;
like image 187
zhubch Avatar answered Oct 12 '22 15:10

zhubch