Skip to content

Commit 194287a

Browse files
committed
docs: FQA
1 parent 7cbac62 commit 194287a

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

FQA.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
## 对讲(talk)
2+
3+
在浏览器中使用麦克风是需要允许的,所以需要用户允许。 [获取麦克风权限](https://developer.mozilla.org/zh-CN/docs/Web/API/WebRTC_API/Build_a_phone_with_peerjs/Connect_peers/Get_microphone_permission)
4+
5+
在 iframe 中使用需要配置 `allow="microphone"`
6+
7+
8+
## [iframe](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Reference/Elements/iframe)
9+
10+
在iframe中,需要设置[同源策略](https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Reference/Headers/Permissions-Policy#iframe)
11+
12+
- [iframe 当全屏请求失败时](https://developer.mozilla.org/zh-CN/docs/Web/API/Fullscreen_API/Guide#%E5%BD%93%E5%85%A8%E5%B1%8F%E8%AF%B7%E6%B1%82%E5%A4%B1%E8%B4%A5%E6%97%B6)
13+
14+
`allowfullscreen` 设置为 true 时,可以通过调用 `<iframe>``requestFullscreen()` 方法激活全屏模式。
15+
16+
```html
17+
<!-- 允许 iframe 激活全屏 -->
18+
<iframe src="..." allowfullscreen="tuue"></iframe>
19+
```
20+
21+
- [iframe 麦克风使用](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Reference/Elements/iframe#allow)
22+
23+
设置 `allow="microphone;"` 时,可以通过调用 `<iframe>``navigator.mediaDevices.getUserMedia({ audio: true })` 获取用户麦克风权限。
24+
25+
```html
26+
<!-- 允许 iframe 访问麦克风 -->
27+
<iframe src="..." allow="microphone;"></iframe>
28+
```
29+

0 commit comments

Comments
 (0)