Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export source handler functions for use externally #1787

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/js/exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@ goog.exportSymbol('videojs.CaptionsButton', vjs.CaptionsButton);
goog.exportSymbol('videojs.ChaptersButton', vjs.ChaptersButton);

goog.exportSymbol('videojs.MediaTechController', vjs.MediaTechController);
goog.exportProperty(vjs.MediaTechController, 'withSourceHandlers', vjs.MediaTechController.withSourceHandlers);
goog.exportProperty(vjs.MediaTechController.prototype, 'featuresVolumeControl', vjs.MediaTechController.prototype.featuresVolumeControl);
goog.exportProperty(vjs.MediaTechController.prototype, 'featuresFullscreenResize', vjs.MediaTechController.prototype.featuresFullscreenResize);
goog.exportProperty(vjs.MediaTechController.prototype, 'featuresPlaybackRate', vjs.MediaTechController.prototype.featuresPlaybackRate);
goog.exportProperty(vjs.MediaTechController.prototype, 'featuresProgressEvents', vjs.MediaTechController.prototype.featuresProgressEvents);
goog.exportProperty(vjs.MediaTechController.prototype, 'featuresTimeupdateEvents', vjs.MediaTechController.prototype.featuresTimeupdateEvents);
goog.exportProperty(vjs.MediaTechController.prototype, 'setPoster', vjs.MediaTechController.prototype.setPoster);


goog.exportSymbol('videojs.Html5', vjs.Html5);
goog.exportProperty(vjs.Html5, 'Events', vjs.Html5.Events);
goog.exportProperty(vjs.Html5, 'isSupported', vjs.Html5.isSupported);
Expand All @@ -154,7 +154,11 @@ goog.exportProperty(vjs.Html5.prototype, 'enterFullScreen', vjs.Html5.prototype.
goog.exportProperty(vjs.Html5.prototype, 'exitFullScreen', vjs.Html5.prototype.exitFullScreen);
goog.exportProperty(vjs.Html5.prototype, 'playbackRate', vjs.Html5.prototype.playbackRate);
goog.exportProperty(vjs.Html5.prototype, 'setPlaybackRate', vjs.Html5.prototype.setPlaybackRate);
// Source Handler Functions
goog.exportProperty(vjs.Html5, 'registerSourceHandler', vjs.Html5.registerSourceHandler);
goog.exportProperty(vjs.Html5, 'selectSourceHandler', vjs.Html5.selectSourceHandler);
goog.exportProperty(vjs.Html5.prototype, 'setSource', vjs.Html5.prototype.setSource);
goog.exportProperty(vjs.Html5.prototype, 'disposeSourceHandler', vjs.Html5.prototype.disposeSourceHandler);

goog.exportSymbol('videojs.Flash', vjs.Flash);
goog.exportProperty(vjs.Flash, 'isSupported', vjs.Flash.isSupported);
Expand All @@ -163,6 +167,11 @@ goog.exportProperty(vjs.Flash, 'onReady', vjs.Flash['onReady']);
goog.exportProperty(vjs.Flash, 'embed', vjs.Flash.embed);
goog.exportProperty(vjs.Flash, 'version', vjs.Flash.version);
goog.exportProperty(vjs.Flash.prototype, 'setSource', vjs.Flash.prototype.setSource);
// Source Handler Functions
goog.exportProperty(vjs.Flash, 'registerSourceHandler', vjs.Flash.registerSourceHandler);
goog.exportProperty(vjs.Flash, 'selectSourceHandler', vjs.Flash.selectSourceHandler);
goog.exportProperty(vjs.Flash.prototype, 'setSource', vjs.Flash.prototype.setSource);
goog.exportProperty(vjs.Flash.prototype, 'disposeSourceHandler', vjs.Flash.prototype.disposeSourceHandler);

goog.exportSymbol('videojs.TextTrack', vjs.TextTrack);
goog.exportProperty(vjs.TextTrack.prototype, 'label', vjs.TextTrack.prototype.label);
Expand Down
19 changes: 17 additions & 2 deletions test/unit/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,34 @@ test('should be able to access expected component API methods', function() {
});

test('should be able to access expected MediaTech API methods', function() {
var techProto = videojs.MediaTechController.prototype;
var media = videojs.MediaTechController;
var mediaProto = videojs.MediaTechController.prototype;
var html5 = videojs.Html5;
var html5Proto = videojs.Html5.prototype;
var flash = videojs.Flash;
var flashProto = videojs.Flash.prototype;

ok(techProto.setPoster, 'setPoster should exist on the Media tech');
ok(mediaProto.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');

ok(videojs.Html5.patchCanPlayType, 'patchCanPlayType should exist for HTML5');
ok(videojs.Html5.unpatchCanPlayType, 'unpatchCanPlayType should exist for HTML5');

// Source Handler Functions
ok(media.withSourceHandlers, 'withSourceHandlers should exist for Media Tech');

ok(videojs.Html5.canPlaySource, 'canPlaySource should exist for HTML5');
ok(videojs.Html5.registerSourceHandler, 'registerSourceHandler should exist for Html5');
ok(videojs.Html5.selectSourceHandler, 'selectSourceHandler should exist for Html5');
ok(videojs.Html5.prototype.setSource, 'setSource should exist for Html5');
ok(videojs.Html5.prototype.disposeSourceHandler, 'disposeSourceHandler should exist for Html5');

ok(videojs.Flash.canPlaySource, 'canPlaySource should exist for Flash');
ok(videojs.Flash.registerSourceHandler, 'registerSourceHandler should exist for Flash');
ok(videojs.Flash.selectSourceHandler, 'selectSourceHandler should exist for Flash');
ok(videojs.Flash.prototype.setSource, 'setSource should exist for Flash');
ok(videojs.Flash.prototype.disposeSourceHandler, 'disposeSourceHandler should exist for Flash');
});

test('should export ready api call to public', function() {
Expand Down