简体中文
主题
简体中文
主题
Web 接入 Kivicube 时,最需要关注的权限主要有三类:
当前插件在打开 iframe 时,会自动写入一组 allow 能力,包括:
xr-spatial-trackingcameramicrophoneautoplayfullscreengyroscopeaccelerometer因此通常不需要你手动再拼写这段字符串;只是不要把它覆盖掉即可。
插件会通过 error 事件抛出带标记的数据:
iframe.addEventListener('error', (event) => {
if (event.detail?.isUserDeniedCamera) {
showCameraPermissionGuide();
}
});如果当前浏览器本身就不能打开摄像头,还可能收到 incompatibility 事件。
这主要影响开启陀螺仪的场景。
iframe.addEventListener('error', (event) => {
if (event.detail?.isUserDeniedGyroscope) {
showGyroscopeGuide();
}
});合辑支持:
hideGyroscopePermission: true它可以隐藏默认的陀螺仪授权提示弹窗,适合确认不再需要此功能的设备,比如iOS。
即便拿到了摄像头权限,视频和音频仍可能受浏览器自动播放策略影响。
最常见的触发因素有:
errorincompatibilityiframe.addEventListener('error', (event) => {
const detail = event.detail || {};
if (detail.isUserDeniedCamera) {
showToast('请允许摄像头权限后重试');
return;
}
if (detail.isUserDeniedGyroscope) {
showToast('请允许动作与方向权限后重试');
return;
}
showToast(detail.message || '体验暂时不可用');
});
iframe.addEventListener('incompatibility', () => {
showUnsupportedDialog();
});