Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

video elements fire 'error' event even when successfully assigning to video.src #22

Closed
aoberoi opened this issue Jun 25, 2015 · 4 comments

Comments

@aoberoi
Copy link
Contributor

aoberoi commented Jun 25, 2015

Can we find a way to intercept and swallow the 'error' event that the

repro:

videoElement.addEventListener('error', function(event) {
  if (event.target.error.code === window.MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED) {
    console.error(':(');
  }
});
videoElement.addEventListneer('loadedmetadata' function() {
  console.log('success!');
});
videoElement.src = URL.createObjectURL(stream);

The output will be:

:(
success!

I only expect:

success!
@ibc
Copy link
Collaborator

ibc commented Jun 25, 2015

I don't see any way to prevent that "error" event. If the user sets a event listener for the "error" event in a <video> element there is little the library/plugin can do to avoid it. In fact, the video element may be later used for rendering a remote video via a HTTP URL, so I prefer not to generate conflict with the element normal behavior.

Said that, it should be documented so I will do it on next days and leave this issue open until done.

@murillo128
Copy link
Contributor

Could it be possible to attach the addEventListener for on 'error' when we capture the src attribute change, and then on the event handler remove it and prevent event propagation?

@ibc
Copy link
Collaborator

ibc commented Jun 25, 2015

It's being coded right now.

@ibc ibc closed this as completed in c5fce48 Jun 25, 2015
@ibc
Copy link
Collaborator

ibc commented Jun 25, 2015

Version 1.3.1 published with this improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants