-
Notifications
You must be signed in to change notification settings - Fork 22.4k
/
index.md
41 lines (29 loc) · 1.13 KB
/
index.md
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
---
title: "HTMLMediaElement: currentSrc property"
short-title: currentSrc
slug: Web/API/HTMLMediaElement/currentSrc
page-type: web-api-instance-property
browser-compat: api.HTMLMediaElement.currentSrc
---
{{APIRef("HTML DOM")}}
The **`HTMLMediaElement.currentSrc`** property contains the
absolute URL of the chosen media resource. This could happen, for example, if the web
server selects a media file based on the resolution of the user's display. The value
is an empty string if the `networkState` property is `EMPTY`.
## Value
A string containing the absolute URL of the chosen media
source; this may be an empty string if `networkState` is `EMPTY`;
otherwise, it will be one of the resources listed by the
{{domxref("HTMLSourceElement")}} contained within the media element, or the value or src
if no {{HTMLElement("source")}} element is provided.
## Examples
```js
const obj = document.createElement("video");
console.log(obj.currentSrc); // ""
```
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}
## See also
- {{domxref("HTMLMediaElement")}}: Interface used to define the `HTMLMediaElement.currentSrc` property