HTMLMediaElement.currentSrc

翻译不完整。 请帮助我们翻译这篇文章!

HTMLMediaElement.currentSrc 属性包含所选媒体源的绝对URL路径。例如当程序会根据用户显示器分辨率选择不同媒体文件时会用到这个属性,显然它是只读的。当networkState值为EMPTY时,本属性值为空字符串(empty string).

语法

var mediaUrl = audioObject.currentSrc;

一个 DOMString 对象包含所选媒体源的绝对URL路径。当 networkState == EMPTY时,其值为空字符串(empty string); 否则,它会是 HTMLSourceElement 所包含媒体列表中的一个,或者是 <source> 标签的src 值.

示例

var obj = document.createElement('video');
console.log(obj.currentSrc); // ""

标准化

标准 状态 备注
HTML Living Standard
HTMLMediaElement.currentSrc
Living Standard No change from HTML5
HTML5
HTMLMediaElement.currentSrc
Recommendation Initial definition.

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
currentSrcChrome Full support 43Edge Full support 12Firefox Full support 3.5IE Full support 9Opera Full support YesSafari Full support 6WebView Android Full support 43Chrome Android Full support 43Firefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support 4.0

Legend

Full support  
Full support

参考