From a02e3609abfe93275809c0499bbe5f0950447d6a Mon Sep 17 00:00:00 2001 From: "Pat O'Neill" Date: Mon, 10 Aug 2015 14:59:47 -0400 Subject: [PATCH] @misteroneill restore videojs.formatTime. closes #2420 --- CHANGELOG.md | 1 + src/js/video.js | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index eee2acee7..e67bf0535 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -88,6 +88,7 @@ CHANGELOG * @gkatsev always use emulated TextTrackLists so tracks survive tech switches ([view](https://github.com/videojs/video.js/pull/2425)) * @misteroneill restore Html5.Events ([view](https://github.com/videojs/video.js/pull/2421)) * @misteroneill removed the deprecated Component init method ([view](https://github.com/videojs/video.js/pull/2427)) +* @misteroneill restore videojs.formatTime ([view](https://github.com/videojs/video.js/pull/2420)) -------------------- diff --git a/src/js/video.js b/src/js/video.js index 643507648..ff20c41f5 100644 --- a/src/js/video.js +++ b/src/js/video.js @@ -13,6 +13,7 @@ import * as Fn from './utils/fn.js'; import assign from 'object.assign'; import { createTimeRange } from './utils/time-ranges.js'; +import formatTime from './utils/format-time.js'; import log from './utils/log.js'; import xhr from './xhr.js'; import * as Dom from './utils/dom.js'; @@ -396,6 +397,18 @@ videojs.log = log; */ videojs.createTimeRange = createTimeRange; +/** + * Format 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 + * + * @param {Number} seconds Number of seconds to be turned into a string + * @param {Number} guide Number (in seconds) to model the string after + * @return {String} Time formatted as H:MM:SS or M:SS + * @method formatTime + */ +videojs.formatTime = formatTime; + /** * Simple http request for retrieving external files (e.g. text tracks) *