HTMLMediaElement.currentSrc
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Please help us by answering a few questions.
HTMLMediaElement.currentSrc
属性包含所选媒体源的绝对 URL 路径。例如当程序会根据用户显示器分辨率选择不同媒体文件时会用到这个属性,显然它是只读的。当 networkState
值为 EMPTY
时,本属性值为空字符串(empty string).
语法
var mediaUrl = audioObject.currentSrc;
值
一个 DOMString
对象包含所选媒体源的绝对 URL 路径。当 networkState
== EMPTY 时,其值为空字符串(empty string)
; 否则,它会是 HTMLSourceElement
所包含媒体列表中的一个,或者是 <source>
标签的 src 值。
示例
js
var obj = document.createElement("video");
console.log(obj.currentSrc); // ""
规范
Specification |
---|
HTML # dom-media-currentsrc-dev |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
currentSrc |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
参考
- The interface defining it,
HTMLMediaElement
.