HTMLMediaElement.src
**
HTMLMediaElement.src**属性反映 HTML 媒体元素的src 属性的值,该属性指示要在元素中使用的媒体资源的 URL。
备注: 了解此元素中当前正在使用的媒体资源的 URL 的最佳方法是查看 currentSrc属性的值,该属性还考虑从 HTMLSourceElement (en-US) (代表 <source> 元素) 中提供的列表中选择最佳或首选媒体资源
Syntax
var mediaUrl = HTMLMediaElement.src;
Value
一个USVString对象,包含要在元素中使用的媒体资源的 URL;此属性反映 HTML 元素的src 属性的值。
Example
js
var obj = document.createElement('video');
console.log(obj.src); // ""
Specifications
| Specification |
|---|
| HTML Standard # dom-media-src |
Browser compatibility
BCD tables only load in the browser
See also
- The interface defining it,
HTMLMediaElement.