format-time.js

Methods

static formatTime(seconds, guide) → {string}

[utils/format-time.js](https://docs.videojs.com/utils_format-time.js.html), [line 90](https://docs.videojs.com/utils_format-time.js.html#line90)

Delegates to either the default time formatting function or a custom function supplied via setFormatTime.

Formats seconds as a time string (H:MM:SS or M:SS). Supplying a guide (in seconds) will force a number of leading zeros to cover the length of the guide.

Parameters:
NameTypeDescription
secondsnumber

Number of seconds to be turned into a string

guidenumber

Number (in seconds) to model the string after

Returns:

string -

Time formatted as H:MM:SS or M:SS

Example
  1. formatTime(125, 600) === "02:05"

static resetFormatTime()

[utils/format-time.js](https://docs.videojs.com/utils_format-time.js.html), [line 67](https://docs.videojs.com/utils_format-time.js.html#line67)

Resets formatTime to the default implementation.

static setFormatTime(customImplementation)

[utils/format-time.js](https://docs.videojs.com/utils_format-time.js.html), [line 60](https://docs.videojs.com/utils_format-time.js.html#line60)

Replaces the default formatTime implementation with a custom implementation.

Parameters:
NameTypeDescription
customImplementationfunction

A function which will be used in place of the default formatTime implementation. Will receive the current time in seconds and the guide (in seconds) as arguments.