Video.js: How to reset/stop?

Created on 13 Mar 2015  路  5Comments  路  Source: videojs/video.js

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?

question

Most helpful comment

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
    */

All 5 comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TheKassaK picture TheKassaK  路  3Comments

askaliuk picture askaliuk  路  3Comments

0xsven picture 0xsven  路  3Comments

stephanedemotte picture stephanedemotte  路  4Comments

SolmazKh picture SolmazKh  路  4Comments