Mixed Content: The page at 'xxx' was loaded over HTTPS, but requested an insecure video 'xxx'. This request has been blocked; the content must be served over HTTPS.", source: xxx
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>视频异常</title>
</head>
<body>
<div class="content">
<video width="100%" controls>
<!-- 替换为实际地址 -->
<source src="example.mp4" type="video/mp4">
</video>
</div>
</body>
</html> import { webview } from '@kit.ArkWeb';
@Entry
@Component
export struct WebVideoIndex {
private controller: WebviewController = new webview.WebviewController();
build() {
Column() {
Web({ src: $rawfile('webVideo.html'), controller: this.controller }) // 加载本地html页面
.width('100%')
.mixedMode(MixedMode.All); // 设置Web组件中的mixedMode属性使其允许加载HTTP和HTTPS混合内容
}
.width('100%')
.height('100%');
}
} 效果图如下:
