Reputation: 1065
I am trying to play a video from my UIWebView and play its audio in the background. This works fine, however when I lock my screen / close out of the view their is a slight delay in sound. The audio goes dead for a split second every time. Why is this happening? Is there a way to access avaudiosession of a UIWebview so I can get more information? Thank you.
Ive tried
adding all info.plist recommendations
enabling background mode
laying out views if needed
webView.mediaPlaybackRequiresUserAction = false
webView.allowsInlineMediaPlayback = true
webView.loadHTMLString(htmlString, baseURL: URL(string: "https://www.youtube.com"))
Upvotes: 0
Views: 62
Reputation: 36
UIWebview is deprecated in swift 4 so for that you need to use WKWebview in same way. read user guide to use class of WKWebview.
Upvotes: 1