New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 718647 link

Starred by 1 user

Issue metadata

Status: Fixed
Closed: Jan 2018
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

issue 713394

Sign in to add a comment

<source> within <video> makes play() promise never throw error

Project Member Reported by, May 4 2017

Issue description

Repro instructions:

Use one of these two html layouts:

html version 1:
<video controls preload='none' src="tulip2.mp4"></video>

html version 2:
<video controls preload='none'>
  <source src="tulip2.mp4" type="video/mp4" />

Run this javascript in devtools:

vid = document.getElementsByTagName('video')[0] () {
}).catch(function(error) {
      console.log('did not play.');

If, for example, the tulip2.mp4 file is just an empty file instead of a real mp4, then for html version 1 an error will be thrown "DOMException: Failed to load because no supported source was found." for html version 2 no error will be thrown and the promise will simply never return.

This was reported here a year ago.

This is one example of the general problem that play() does not reliably let me know whether or not it worked.
I believe it's a bug in the Promise play() implementation.

Caleb, what other unreliability did you have in mind? If promise resolved, play() worked, if it threw an exception, it didn't.
Oftentimes the promise never gets resolved either way. For example, if I pass a path to a media file that doesn't exist. I get an error in that case, but the promise doesn't get resolved.
(The error doesn't occur in the "catch" of the promise.)
Components: -Internals>Media Blink>Media
-timvolodine@ +foolip@

My understanding is that the issue is WAI as when <source> is used, we are running the resource selection algorithm [1] in the "children" mode which will wait for another <source>. I'm pretty sure there was another bug open about this but I can't find it.

foolip@, is my understanding correct?

Yeah, unfortunately this isn't really possible to solve without deciding to stop waiting for source elements at some arbitrary point. This was mentioned in but I think we might have discussed it on crbug somewhere as well.
Perhaps you could provide guidance to a web developer who wants to figure out

1. Did the video start playing successfully? (boolean)
2. If it failed, why did it fail? (Error text string)

How can a web developer figure out both 1 and 2 and then use that data for future decisions in the code? For example, 

A. Is there a way to check to see whether the resource selection algorithm is waiting? 
B. Is there a way to figure out that there was a network error in loading one of the sources?
+ tech writer jmedley@

If we could figure out how to do these things, we could update to help developers.
This makes no sense.
Why would anybody assume what calling play() before sources are present would work?

Status: Assigned (was: Available)
Okay, after some discussion in Kirkland, it seems like this is true:

1. For <video src="video.format"\>, 
the promise works as expected and explained in the blog post. (One caveat is that if "video.format" does not exist on the server, you get the unhelpful "Failed to load because no supported source was found." error instead of a more helpful error.)

2. For <video><source src="video.format" type='blah/blah'></video>
the promise only works for the gesture requirement. It does not work to check, as the blog post suggested where "Automatic playback failed."

It would be helpful to explain this somehow in the blog post so that developers aren't confused.

jmedley@, would you be able to take this on? otherwise feel free to take yourself out of this bug.
Thanks for the ping! I'll make sure our doc is updated and will let you know when it's live.
Pull Request is available at

Sign in to add a comment