소스 검색

1.新手引导视频 播放点击返回键无效 闪退问题修复

huangxiaodong 1 주 전
부모
커밋
cd51d68233
1개의 변경된 파일17개의 추가작업 그리고 1개의 파일을 삭제
  1. 17 1
      创维盒子/code/Class/Set/CustomerWebViewController.m

+ 17 - 1
创维盒子/code/Class/Set/CustomerWebViewController.m

@@ -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];