From 2005fe213625ea436a44408b3320adf85e5f821e Mon Sep 17 00:00:00 2001 From: Steve Heffernan Date: Wed, 5 Mar 2014 16:08:49 -0800 Subject: [PATCH] Exporting tech.setPoster(). Fixes #1028 --- src/js/exports.js | 2 ++ src/js/media/media.js | 8 ++++++++ test/unit/api.js | 10 ++++++++++ 3 files changed, 20 insertions(+) diff --git a/src/js/exports.js b/src/js/exports.js index c17b78ab3..ce1e16968 100644 --- a/src/js/exports.js +++ b/src/js/exports.js @@ -114,6 +114,8 @@ goog.exportProperty(vjs.MediaTechController.prototype.features, 'volumeControl', goog.exportProperty(vjs.MediaTechController.prototype.features, 'fullscreenResize', vjs.MediaTechController.prototype.features.fullscreenResize); goog.exportProperty(vjs.MediaTechController.prototype.features, 'progressEvents', vjs.MediaTechController.prototype.features.progressEvents); goog.exportProperty(vjs.MediaTechController.prototype.features, 'timeupdateEvents', vjs.MediaTechController.prototype.features.timeupdateEvents); +goog.exportProperty(vjs.MediaTechController.prototype, 'setPoster', vjs.MediaTechController.prototype.setPoster); + goog.exportSymbol('videojs.Html5', vjs.Html5); goog.exportProperty(vjs.Html5, 'Events', vjs.Html5.Events); diff --git a/src/js/media/media.js b/src/js/media/media.js index c87589017..842c75967 100644 --- a/src/js/media/media.js +++ b/src/js/media/media.js @@ -139,6 +139,14 @@ vjs.MediaTechController.prototype.onTap = function(){ this.player().userActive(!this.player().userActive()); }; +/** + * Provide a default setPoster method for techs + * + * Poster support for techs should be optional, so we don't want techs to + * break if they don't have a way to set a poster. + */ +vjs.MediaTechController.prototype.setPoster = function(){}; + vjs.MediaTechController.prototype.features = { 'volumeControl': true, diff --git a/test/unit/api.js b/test/unit/api.js index 307ab6b2e..bc8fe8d3b 100644 --- a/test/unit/api.js +++ b/test/unit/api.js @@ -83,6 +83,16 @@ test('should be able to access expected component API methods', function() { ok(comp.buildCSSClass, 'buildCSSClass exists'); }); +test('should be able to access expected MediaTech API methods', function() { + var techProto = videojs.MediaTechController.prototype; + var html5Proto = videojs.Html5.prototype; + var flashProto = videojs.Flash.prototype; + + ok(techProto.setPoster, 'setPoster should exist on the Media tech'); + ok(html5Proto.setPoster, 'setPoster should exist on the HTML5 tech'); + ok(flashProto.setPoster, 'setPoster should exist on the Flash tech'); +}); + test('should export ready api call to public', function() { var videoTag = PlayerTest.makeTag();