blob: 03ad0d227955eaa0c8062ad61ea9086179bcea4f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
---
title: MediaStream.id
slug: Web/API/MediaStream/id
translation_of: Web/API/MediaStream/id
---
<p>{{APIRef("WebRTC")}}</p>
<p><code><strong>MediaStream.id</strong></code> 只读属性,一个包含36个字符的 {{domxref("DOMString")}} ,用来作为这个对象的唯一标识符 (GUID) 。</p>
<h2 id="Syntax" name="Syntax">语法</h2>
<pre class="syntaxbox">var <em>id</em> = <em>mediaStream</em>.id;
</pre>
<h2 id="示例">示例</h2>
<pre class="brush: js"><code class="language-html">var p = navigator.mediaDevices.getUserMedia({ audio: true, video: true });
p.then(function(stream) {
console.log(stream.id);
};)
</code></pre>
<h2 id="规范">规范</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
<tr>
<td>{{SpecName('Media Capture', '#widl-MediaStream-id', 'MediaStream.id')}}</td>
<td>{{Spec2('Media Capture')}}</td>
<td>Initial definition.</td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility" name="Browser_compatibility">浏览器兼容性</h2>
{{Compat("api.MediaStream.id")}}
<h2 id="相关链接">相关链接</h2>
<ul>
<li>{{domxref("MediaStream")}},包含该属性的接口。</li>
</ul>
|