How to get src for multi-source video?

I would like to get the src value that is actually used for the video element, for example:

<video>
  <source src="foo.mp4"  type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
  <source src="foo.webm" type='video/webm; codecs="vp8, vorbis"'>
  <source src="foo.ogv"  type='video/ogg; codecs="theora, vorbis"'>
</video>

In Firefox (at least) src is defined for the source elements, but not for the video element.

How to find out which source is used?

+3
source share
1 answer

I think I answered my own question: the currentSrc property of the video element.

This works in Firefox, Safari (and Chrome, I suppose), on Windows XP SP3, at least.

UPDATE: as pointed out to me in the comments below, there is currentSrc documentation in the WHATWG spec .

+4
source

Source: https://habr.com/ru/post/1747318/


All Articles