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

dispose() does not stop video from downloading on Firefox #1297

Closed
sethborg opened this issue Jun 16, 2014 · 8 comments
Closed

dispose() does not stop video from downloading on Firefox #1297

sethborg opened this issue Jun 16, 2014 · 8 comments
Labels

Comments

@sethborg
Copy link
Contributor

Dispose removes the player but in Firefox (open firebug to the "Net" tab) the movie still loads in the background.

Calling dispose stops the video from downloading any further in chrome but not in Firefox. To do that you need to set the source to blank. Please add this to the dispose function.

// I have to set src to blank before calling dispose in order to make it work in firefox
// dispose() should set src to blank automatically
videojs('video').src('');  //<- Add this to the dispose() function
videojs('video').dispose();
@mmcc mmcc added the bug label Jun 16, 2014
@mmcc
Copy link
Member

mmcc commented Jun 16, 2014

Want to throw together a pull request for this?

@sethborg
Copy link
Contributor Author

Not really sure how, also Firefox shows this warning in the console "Invalid URI. Load of media resource failed." so setting src to blank might not be the best way to do it? Any ideas?

@mmcc
Copy link
Member

mmcc commented Jun 23, 2014

Ok so just looked through the current behavior with @heff, and it looks like the best thing to do here is call disposeMediaElement from the dispose method. Should be a pretty quick and easy fix, so if you're interested in trying your hand at contributing the contributing guide can help you get started. What do you think?

@mmcc
Copy link
Member

mmcc commented Jun 30, 2014

@sethborg ping. Any interest in putting together a PR for this?

@sethborg
Copy link
Contributor Author

sethborg commented Jul 7, 2014

Not quite sure what to put where. Is this correct?

vjs.Component.prototype.dispose = function(){
  this.trigger('dispose');

  if (this.techName === 'Html5' && this.tag) {
    vjs.Html5.disposeMediaElement(this.tag);
  }
}

Also I noticed calling videojs('bumpboxVideo').src(''); causes the flash player (IE8) to throw an error in vjs.Flash.prototype.play = function(){ this.el_.vjs_play(); };

Edits by @mmcc - Code blocks for readability

@mmcc
Copy link
Member

mmcc commented Jul 7, 2014

That looks good. I would consider putting it between these two lines (115 and 117 in master):

  this.off('dispose');

  // Kill reference to this player

What's the context around the empty src call? It sounds like that might be a different issue, so we should probably take that one to a different thread.

@sethborg
Copy link
Contributor Author

sethborg commented Jul 8, 2014

OK I updated component.js (pull request) btw it is this.off() not this.off('dispose') just curious where you got that from.

As for the videojs('bumpboxVideo').src(''); I was using that as my temporary fix to stop firefox from downloading the movie in the background but doing that causes IE8 to throw an error. Not sure if you care to put any logic in there to prevent playing a movie if the video url is empty or not.

@mmcc
Copy link
Member

mmcc commented Jul 11, 2014

Just to have the reference, the associated PR: #1334

@mmcc mmcc closed this as completed Sep 2, 2014
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants