diff --git a/src/player.js b/src/player.js index a540264b2..88e4b218a 100644 --- a/src/player.js +++ b/src/player.js @@ -25,6 +25,20 @@ import PlaybackMiddleware from './middleware/playback-middleware' import DefaultPlayerConfig from './player-config.json' import './assets/style.css' +/** + * The player playback rates. + * @type {Array} + * @const + */ +const PLAYBACK_RATES = [0.5, 1, 2, 4]; + +/** + * The player default playback rate. + * @type {number} + * @const + */ +const DEFAULT_PLAYBACK_RATE = 1; + /** * The player container class name. * @type {string} @@ -655,6 +669,22 @@ export default class Player extends FakeEventTarget { } } + /** + * Gets the possible playback speeds of the video. + * @returns {Array} - The possible playback speeds speed of the video. + */ + get playbackRates(): Array { + return PLAYBACK_RATES; + } + + /** + * Gets the default playback speed of the video. + * @returns {number} - The default playback speed of the video. + */ + get defaultPlaybackRate(): number { + return DEFAULT_PLAYBACK_RATE; + } + /** * get the engine type * @returns {string} - html5 @@ -978,6 +1008,29 @@ export default class Player extends FakeEventTarget { // + // + + /** + * get the log level + * @param {?string} name - the logger name + * @returns {Object} - the log level + */ + getLogLevel(name?: string): Object { + return getLogLevel(name); + } + + /** + * sets the logger level + * @param {Object} level - the log level + * @param {?string} name - the logger name + * @returns {void} + */ + setLogLevel(level: Object, name?: string) { + setLogLevel(level, name); + } + + // + // // @@ -1603,22 +1656,4 @@ export default class Player extends FakeEventTarget { } // - /** - * get the log level - * @param {?string} name - the logger name - * @returns {Object} - the log level - */ - getLogLevel(name?: string): Object { - return getLogLevel(name); - } - - /** - * sets the logger level - * @param {Object} level - the log level - * @param {?string} name - the logger name - * @returns {void} - */ - setLogLevel(level: Object, name?: string) { - setLogLevel(level, name); - } } diff --git a/test/src/player.spec.js b/test/src/player.spec.js index b3892a02e..c6eca719b 100644 --- a/test/src/player.spec.js +++ b/test/src/player.spec.js @@ -2693,3 +2693,15 @@ describe('logger', () => { currentLogLevel.should.equal(player.LogLevel.DEBUG); }); }); + +describe('playbackRate', () => { + it('should return the possible playback rates of the player', () => { + const player = new Player(); + player.playbackRates.should.deep.equal([0.5, 1, 2, 4]); + }); + + it('should return the default playback rate of the player', () => { + const player = new Player(); + player.defaultPlaybackRate.should.equal(1); + }); +});