blob: 4c25adaa56db1265e9ff4ff88be447b4c0c33c43 (
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
50
51
52
53
54
55
56
|
---
title: HTMLMediaElement.currentSrc
slug: Web/API/HTMLMediaElement/currentSrc
translation_of: Web/API/HTMLMediaElement/currentSrc
---
<div>{{APIRef("HTML DOM")}}</div>
<p><strong><code>HTMLMediaElement.currentSrc</code></strong> 属性包含所选媒体源的绝对URL路径。例如当程序会根据用户显示器分辨率选择不同媒体文件时会用到这个属性,显然它是只读的。当<code><strong>networkState</strong></code>值为<code><strong>EMPTY</strong></code>时,本属性值为空字符串(empty string).</p>
<h2 id="Syntax" name="Syntax">语法</h2>
<pre class="syntaxbox">var <em>mediaUrl</em> = <em>audioObject</em>.currentSrc;</pre>
<h3 id="值">值</h3>
<p>一个 {{domxref("DOMString")}} 对象包含所选媒体源的绝对URL路径。当 <code>networkState</code> == <code>EMPTY时,其值为空字符串(empty string)</code>; 否则,它会是 {{domxref("HTMLSourceElement")}} 所包含媒体列表中的一个,或者是 {{HTMLElement("source")}} 标签的src 值.</p>
<h2 id="示例">示例</h2>
<pre class="brush: js">var obj = document.createElement('video');
console.log(obj.currentSrc); // ""
</pre>
<h2 id="标准化">标准化</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">标准</th>
<th scope="col">状态</th>
<th scope="col">备注</th>
</tr>
<tr>
<td>{{SpecName('HTML WHATWG', "#dom-media-currentsrc", "HTMLMediaElement.currentSrc")}}</td>
<td>{{Spec2('HTML WHATWG')}}</td>
<td>No change from {{SpecName('HTML5 W3C')}}</td>
</tr>
<tr>
<td>{{SpecName('HTML5 W3C', "embedded-content-0.html#htmlmediaelement", "HTMLMediaElement.currentSrc")}}</td>
<td>{{Spec2('HTML5 W3C')}}</td>
<td>Initial definition.</td>
</tr>
</tbody>
</table>
<h2 id="浏览器兼容性">浏览器兼容性</h2>
<p>{{Compat("api.HTMLMediaElement.currentSrc")}}</p>
<h2 id="See_Also" name="See_Also">参考</h2>
<ul>
<li>The interface defining it, {{domxref("HTMLMediaElement")}}.</li>
</ul>
|