|
@@ -70,8 +70,24 @@
|
|
|
|
|
|
self.titleLabel.text = titleStr;
|
|
|
|
|
|
- // WKWebView
|
|
|
+ // 初始化配置对象
|
|
|
WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc] init];
|
|
|
+
|
|
|
+ if (@available(iOS 18.0, *)) {
|
|
|
+ // 系统版本 ≥ 18.0
|
|
|
+
|
|
|
+ // 默认是NO,这个值决定了用内嵌HTML5播放视频还是用本地的全屏控制
|
|
|
+ config.allowsInlineMediaPlayback = YES;
|
|
|
+ // 自动播放, 不需要用户采取任何手势开启播放
|
|
|
+ // WKAudiovisualMediaTypeNone 音视频的播放不需要用户手势触发, 即为自动播放
|
|
|
+ config.mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeNone;
|
|
|
+ config.allowsAirPlayForMediaPlayback = YES;
|
|
|
+ config.allowsPictureInPictureMediaPlayback = YES;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // WKWebView
|
|
|
+ //WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc] init];
|
|
|
self.webView = [[WKWebView alloc] initWithFrame:CGRectMake(0, 0, 0, 0) configuration:config];
|
|
|
// 解决闪白问题
|
|
|
self.view.backgroundColor = [UIColor whiteColor];
|