Compare commits

...
2 Commits
Author SHA1 Message Date
ddisfriend 583ed9d006 fix: 配置 WKWebView 以支持 H5 相机内联预览
- allowsInlineMediaPlayback = true
- mediaTypesRequiringUserActionForPlayback = []

解决车辆管理-行驶证拍摄页面 CameraGuide 组件在 iOS WebView 中预览黑屏/不显示的问题。
2026-08-05 13:53:40 +08:00
ddisfriend 83090a2972 充电管理 2026-07-29 19:54:20 +08:00
2 changed files with 7 additions and 1 deletions
@@ -24,6 +24,12 @@ class WebViewController : ZDViewController {
let config = WKWebViewConfiguration()
config.userContentController = WKUserContentController()
// H5 iOS WebView /WecRTC
config.allowsInlineMediaPlayback = true
if #available(iOS 10.0, *) {
config.mediaTypesRequiringUserActionForPlayback = []
}
//
let script = WKUserScript(source: "window.__IN_APP_WEBVIEW__ = true;", injectionTime: .atDocumentStart, forMainFrameOnly: false)
config.userContentController.addUserScript(script)
@@ -170,7 +170,7 @@ open class WebViewTool : NSObject {
vc = WebViewController(showNavBar:false, title: nil, url: "\((h5Models?.managerPeople)!)?token=\((USER.token)!)"+(appending ?? ""))
break
case .gjUrl:
vc = WebViewController(showNavBar:true, title: nil, url: "\((h5Models?.gjUrl)!)?"+(appending ?? ""), hiddenNavBarURLPaths: ["/h5/pages/order/list", "/h5/pages/invoice/list", "/h5/pages/order/detail", "/h5/pages/invoice/detail"])
vc = WebViewController(showNavBar:true, title: nil, url: "\((h5Models?.gjUrl)!)?"+(appending ?? ""), hiddenNavBarURLPaths: ["/h5/pages/order/list", "/h5/pages/invoice/list", "/h5/pages/order/detail", "/h5/pages/invoice/detail", "/h5/pages/invoice/form"])
break
}