5

iOS 12.2 real machine can not play the video in html5 loaded by UIWebView, link url http://community.cqliving.com/h5/info/detail/512.html?cid=512&isOpenApp=&f=10, other versions can play video

Rendering

gkh
  • 51
  • 1
  • 4

4 Answers4

4

Try including these two lines

webView.allowsInlineMediaPlayback = YES;
webView.mediaPlaybackRequiresUserAction = NO;

These lines solved my issue which is occurring in iOS 12.2

Sateesh Pasala
  • 772
  • 8
  • 15
2

Is it embedded using UIWebView or WKWebView or similar?

Try setting mediaPlaybackRequiresUserAction to YES for the webview. I'm seeing the same issue (UIWebView and WKWebView both) in iOS 12.2. Works fine in iOS 12.1 and earlier.

When debugging, you see this error in safari console:

Unhandled Promise Rejection: NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission

https://developer.apple.com/documentation/uikit/uiwebview/1617954-mediaplaybackrequiresuseraction?language=objc

https://developer.apple.com/documentation/webkit/wkwebviewconfiguration/1614727-mediaplaybackrequiresuseraction?language=objc

Could be similar to this issue

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

1800 INFORMATION
  • 131,367
  • 29
  • 160
  • 239
2

mediaPlaybackRequiresUserAction = NO; look:https://www.jianshu.com/p/d3f326dae445

Jayxiang
  • 71
  • 3
1

You will need to enable insecure content loading in your app. Otherwise if you would not like to do that you can create a mirror of the video on a secure server.

https://stackoverflow.com/a/30732693 see here for more info.

Brandon Stillitano
  • 1,304
  • 8
  • 27
  • Thank you ! http://community.cqliving.com/h5/info/detail/512.html?cid=512&isOpenApp=&f=10 The video in h5 webpage cannot be played. in IOS 12.2 Other version Can Played – gkh Apr 24 '19 at 02:36