Hello,
How to stop/reset the player? As close as I can find were dispose() and pause().
For dispose(), I don't want to kill the player and re-generate one.
For pause(), I want not only stop playing but also clear the movie which will make the player shows only black.
I just want to stop the video and clear all src attached, which is much like a reset function. But I cannot find anything like reset in the API doc. Is there any way to achieve that?
You could try
player.pause();
player.src(''); // empty string
That might do it.
I've tried but this will shows error message on that player.
Don't do this. It won't allow you to reload cleanly.
VIDEOJS: ERROR: (CODE:4 MEDIA_ERR_SRC_NOT_SUPPORTED) The media could not be loaded, either because the server or network failed or because the format is not supported.
We actually have a new feature to allow this: player.reset(). Added in 5.4.1.
/**
* Reset the player. Loads the first tech in the techOrder,
* and calls `reset` on the tech`.
*
* @return {Player} Returns the player
* @method reset
*/
not work for reset method
Most helpful comment
We actually have a new feature to allow this:
player.reset(). Added in 5.4.1.