ios, why webview load web with Phaser webaudio no sound when i mute the iphone or ipad ,my demo code like this
override func viewDidLoad() {
super.viewDidLoad()
view.addSubview(webView)
let request = URLRequest(url: URL(string: "https://opas.firstleap.cn/web/game/1_1.1/index.html?pid=59149&&page=1")!) // this url is my app real url
webView.load(request)
}
lazy fileprivate var webView: WKWebView = {
let configuration = WKWebViewConfiguration()
configuration.mediaPlaybackRequiresUserAction = false
configuration.allowsInlineMediaPlayback = true
let webView = WKWebView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height), configuration: configuration)
webView.sizeToFit()
webView.isOpaque = false //这个属性必须设置为false,否则在网络不好的情况下app推出后台,再次进来此页面会白屏
webView.autoresizesSubviews = true
webView.contentMode = .scaleToFill
webView.scrollView.bounces = false
webView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
webView.scrollView.contentSize = CGSize(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height)
return webView
}()