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

Setting src to an empty string throws an error. #1785

Closed
walruscow opened this issue Jan 8, 2015 · 10 comments
Closed

Setting src to an empty string throws an error. #1785

walruscow opened this issue Jan 8, 2015 · 10 comments

Comments

@walruscow
Copy link

Is there a good way to stop the current video from loading? player.src('') works but spews errors into the console, which is undesirable.

Why not dispose of the player? I want to continue playing the same video later, I just don't want it eating bandwidth while "paused".

@mmcc
Copy link
Member

mmcc commented Jan 8, 2015

This looks like a regression, setting src to an empty string should work.

@02clams
Copy link

02clams commented Jan 12, 2015

I ran into this several version ago and fixed it by using a single space for the src(" "). An empty string caused the video to continue loading, but the single space finally terminated the connection.

@mmcc
Copy link
Member

mmcc commented Jan 12, 2015

Ok so I think we're all talking about different things here. There's an actual issue that was introduced in 4.11.3 that we're putting out a fix for right now.

@02clams if you're referring to the MEDIA_ERR_SRC_NOT_SUPPORTED error, that's an error that's getting thrown because a blank string is technically not a supported source, so we're getting that error from the video element.

@walruscow
Copy link
Author

I was also referring to the MEDIA_ERR_SRC_NOT_SUPPORTED error (looks like two in console, but upon inspection seems to be just one). Thanks for such a quick and helpful response! :)

@ange007
Copy link
Contributor

ange007 commented Jan 23, 2015

Perhaps I do something not so, but in the last stable version ( with the editings given above ), at: _player.src (' ');_

Linyx Mint 17, Chrome 40:

VIDEOJS: TypeError: Cannot read property 'handleSource' of null {stack: (...), message: "Cannot read property 'handleSource' of null"}

Linux Mint 17, FF 35:

"VIDEOJS:" TypeError: sh is null

@mmcc
Copy link
Member

mmcc commented Jan 23, 2015

@ange007 #1787 fixed this and went out with today's patch release (4.11.4).

@mmcc mmcc closed this as completed Jan 23, 2015
@ange007
Copy link
Contributor

ange007 commented Jan 26, 2015

Last version.

this.player.pause( );
this.player.src( '' );

Result:
http://i.imgur.com/0AcHrYe.png

@mmcc
Copy link
Member

mmcc commented Jan 26, 2015

You're totally right. I'm going to edit this title to be a little more descriptive and re-open.

@mmcc mmcc changed the title Stop video loading Setting src to an empty string throws an error. Jan 26, 2015
@mmcc mmcc reopened this Jan 26, 2015
@ksheurs
Copy link

ksheurs commented Feb 27, 2015

Is there a preferred way to clear out the source in 4.12.2?

I am using the resolutions plugin that seems to set this on load. See https://github.com/vidcaster/video-js-resolutions/blob/master/video-js-resolutions.js#L42 for reference.

With that line in there, I am also seeing the Uncaught TypeError: Cannot read property 'handleSource' of null error.

@ksheurs
Copy link

ksheurs commented Feb 28, 2015

thanks for that!

@gkatsev gkatsev closed this as completed Nov 10, 2015
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants