This repository has been archived by the owner on Aug 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
df205d7
commit 5186747
Showing
4 changed files
with
406 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
order: 7 | ||
title: XR 兼容性 | ||
type: XR | ||
label: XR | ||
--- | ||
|
||
XR 系统支持多后端(可参照[XR 总览](${docs}xr-overall)),目前官方仅适配了 WebXR 标准,因此 XR 互动的兼容性也**受限于设备对 WebXR** 的兼容。 | ||
|
||
在使用 XR 能力前,可参考 [CanIUse](https://caniuse.com/?search=webxr) 对运行环境进行评估,下方是当下 WebXR 兼容性的概括。 | ||
|
||
## 设备支持 | ||
|
||
### PC | ||
|
||
- 支持 WebXR 的 PC 端浏览器(本文使用 Mac Chrome) | ||
- PC 端 Chrome 安装 [Immersive Web Emulator](https://chromewebstore.google.com/detail/immersive-web-emulator/cgffilbpcibhmcfbgggfhfolhkfbhmik) 或其他 WebXR 模拟插件 | ||
|
||
### 安卓 | ||
|
||
- 支持 WebXR 的终端与浏览器(本文使用安卓机与安卓机搭载的移动端 Chrome 应用) | ||
- 安卓手机需额外安装 [Google Play Services for AR](https://play.google.com/store/apps/details?id=com.google.ar.core&hl=en_US&pli=1) | ||
|
||
### IOS | ||
|
||
- 苹果手机端 Safari 暂不支持 WebXR | ||
- Apple Vision Pro 支持 WebXR | ||
|
||
### 头显设备 | ||
|
||
视情况而定,可参考头显官网对兼容性的说明,大部分头显中的浏览器(内核为 Chromium 的浏览器)都支持 WebXR | ||
|
||
## 运行时兼容性判断 | ||
|
||
在 runtime 中,您可以通过如下代码判断当前环境是否支持 `AR` 或 `VR`: | ||
|
||
```typescript | ||
// 判断是否支持 AR | ||
xrManager.sessionManager.isSupportedMode(XRSessionMode.AR); | ||
``` | ||
|
||
在添加功能前,您可以通过如下代码判断该功能的兼容性: | ||
|
||
```typescript | ||
// 判断是否支持图片追踪 | ||
xrManager.isSupportedFeature(XRImageTracking); | ||
``` | ||
|
||
## 安卓开启试验功能 | ||
|
||
安卓支持某些试验功能,但是开关时默认关闭的,此时可以通过设置 flags 打开,**安卓打开 Chrome** -> **登陆 chrome://flags** -> **搜索 WebXR** -> **打开 WebXR Incubations** | ||
|
||
<img src="https://mdn.alipayobjects.com/huamei_yo47yq/afts/img/A*YJCVTIAe0nEAAAAAAAAAAAAADhuCAQ/original" alt="image.png" style="zoom:50%;" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.