Skip to content

Commit

Permalink
Changed to feature prefix over suffix to make it read more as a boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
heff committed Sep 2, 2014
1 parent c90d7d3 commit f3925c7
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 33 deletions.
4 changes: 2 additions & 2 deletions src/js/control-bar/mute-toggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ vjs.MuteToggle = vjs.Button.extend({
player.on('volumechange', vjs.bind(this, this.update));

// hide mute toggle if the current tech doesn't support volume control
if (player.tech && player.tech['volumeControlFeature'] === false) {
if (player.tech && player.tech['featuresVolumeControl'] === false) {
this.addClass('vjs-hidden');
}
player.on('loadstart', vjs.bind(this, function(){
if (player.tech['volumeControlFeature'] === false) {
if (player.tech['featuresVolumeControl'] === false) {
this.addClass('vjs-hidden');
} else {
this.removeClass('vjs-hidden');
Expand Down
2 changes: 1 addition & 1 deletion src/js/control-bar/playback-rate-menu-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ vjs.PlaybackRateMenuButton.prototype.onClick = function(){

vjs.PlaybackRateMenuButton.prototype.playbackRateSupported = function(){
return this.player().tech
&& this.player().tech['playbackRateFeature']
&& this.player().tech['featuresPlaybackRate']
&& this.player().options()['playbackRates']
&& this.player().options()['playbackRates'].length > 0
;
Expand Down
4 changes: 2 additions & 2 deletions src/js/control-bar/volume-control.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ vjs.VolumeControl = vjs.Component.extend({
vjs.Component.call(this, player, options);

// hide volume controls when they're not supported by the current tech
if (player.tech && player.tech['volumeControlFeature'] === false) {
if (player.tech && player.tech['featuresVolumeControl'] === false) {
this.addClass('vjs-hidden');
}
player.on('loadstart', vjs.bind(this, function(){
if (player.tech['volumeControlFeature'] === false) {
if (player.tech['featuresVolumeControl'] === false) {
this.addClass('vjs-hidden');
} else {
this.removeClass('vjs-hidden');
Expand Down
4 changes: 2 additions & 2 deletions src/js/control-bar/volume-menu-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ vjs.VolumeMenuButton = vjs.MenuButton.extend({
player.on('volumechange', vjs.bind(this, this.update));

// hide mute toggle if the current tech doesn't support volume control
if (player.tech && player.tech['volumeControlFeature'] === false) {
if (player.tech && player.tech['featuresVolumeControl'] === false) {
this.addClass('vjs-hidden');
}
player.on('loadstart', vjs.bind(this, function(){
if (player.tech['volumeControlFeature'] === false) {
if (player.tech['featuresVolumeControl'] === false) {
this.addClass('vjs-hidden');
} else {
this.removeClass('vjs-hidden');
Expand Down
10 changes: 5 additions & 5 deletions src/js/exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ goog.exportSymbol('videojs.CaptionsButton', vjs.CaptionsButton);
goog.exportSymbol('videojs.ChaptersButton', vjs.ChaptersButton);

goog.exportSymbol('videojs.MediaTechController', vjs.MediaTechController);
goog.exportProperty(vjs.MediaTechController.prototype, 'volumeControlFeature', vjs.MediaTechController.prototype.volumeControlFeature);
goog.exportProperty(vjs.MediaTechController.prototype, 'fullscreenResizeFeature', vjs.MediaTechController.prototype.fullscreenResizeFeature);
goog.exportProperty(vjs.MediaTechController.prototype, 'playbackRateFeature', vjs.MediaTechController.prototype.playbackRateFeature);
goog.exportProperty(vjs.MediaTechController.prototype, 'progressEventsFeature', vjs.MediaTechController.prototype.progressEventsFeature);
goog.exportProperty(vjs.MediaTechController.prototype, 'timeupdateEventsFeature', vjs.MediaTechController.prototype.timeupdateEventsFeature);
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);


Expand Down
8 changes: 4 additions & 4 deletions src/js/media/html5.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ vjs.Html5 = vjs.MediaTechController.extend({
/** @constructor */
init: function(player, options, ready){
// volume cannot be changed from 1 on iOS
this['volumeControlFeature'] = vjs.Html5.canControlVolume();
this['featuresVolumeControl'] = vjs.Html5.canControlVolume();

// just in case; or is it excessively...
this['playbackRateFeature'] = vjs.Html5.canControlPlaybackRate();
this['featuresPlaybackRate'] = vjs.Html5.canControlPlaybackRate();

// In iOS, if you move a video element in the DOM, it breaks video playback.
this['movingMediaElementInDOM'] = !vjs.IS_IOS;

// HTML video is able to automatically resize when going to fullscreen
this['fullscreenResizeFeature'] = true;
this['featuresFullscreenResize'] = true;

// HTML video supports progress events
this['progressEventsFeature'] = true;
this['featuresProgressEvents'] = true;

vjs.MediaTechController.call(this, player, options, ready);
this.setupTriggers();
Expand Down
16 changes: 8 additions & 8 deletions src/js/media/media.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ vjs.MediaTechController = vjs.Component.extend({
vjs.Component.call(this, player, options, ready);

// Manually track progress in cases where the browser/flash player doesn't report it.
if (!this['progressEventsFeature']) {
if (!this['featuresProgressEvents']) {
this.manualProgressOn();
}

// Manually track timeudpates in cases where the browser/flash player doesn't report it.
if (!this['timeupdateEventsFeature']) {
if (!this['featuresTimeupdateEvents']) {
this.manualTimeUpdatesOn();
}

Expand Down Expand Up @@ -210,7 +210,7 @@ vjs.MediaTechController.prototype.manualTimeUpdatesOn = function(){
// Watch for native timeupdate event
this.one('timeupdate', function(){
// Update known progress support for this playback technology
this['timeupdateEventsFeature'] = true;
this['featuresTimeupdateEvents'] = true;
// Turn off manual progress tracking
this.manualTimeUpdatesOff();
});
Expand Down Expand Up @@ -261,15 +261,15 @@ vjs.MediaTechController.prototype.setCurrentTime = function() {
*/
vjs.MediaTechController.prototype.setPoster = function(){};

vjs.MediaTechController.prototype['volumeControlFeature'] = true;
vjs.MediaTechController.prototype['featuresVolumeControl'] = true;

// Resizing plugins using request fullscreen reloads the plugin
vjs.MediaTechController.prototype['fullscreenResizeFeature'] = false;
vjs.MediaTechController.prototype['playbackRateFeature'] = false;
vjs.MediaTechController.prototype['featuresFullscreenResize'] = false;
vjs.MediaTechController.prototype['featuresPlaybackRate'] = false;

// Optional events that we can manually mimic with timers
// currently not triggered by video-js-swf
vjs.MediaTechController.prototype['progressEventsFeature'] = false;
vjs.MediaTechController.prototype['timeupdateEventsFeature'] = false;
vjs.MediaTechController.prototype['featuresProgressEvents'] = false;
vjs.MediaTechController.prototype['featuresTimeupdateEvents'] = false;

vjs.media = {};
2 changes: 1 addition & 1 deletion src/js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -1530,7 +1530,7 @@ vjs.Player.prototype.playbackRate = function(rate) {
return this;
}

if (this.tech && this.tech['playbackRateFeature']) {
if (this.tech && this.tech['featuresPlaybackRate']) {
return this.techGet('playbackRate');
} else {
return 1.0;
Expand Down
8 changes: 4 additions & 4 deletions test/unit/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test('should hide volume control if it\'s not supported', function(){
language: noop,
languages: noop,
tech: {
'volumeControlFeature': false
'featuresVolumeControl': false
},
volume: function(){},
muted: function(){},
Expand Down Expand Up @@ -45,7 +45,7 @@ test('should test and toggle volume control on `loadstart`', function(){
return false;
},
tech: {
'volumeControlFeature': true
'featuresVolumeControl': true
},
reportUserActivity: function(){}
};
Expand All @@ -58,7 +58,7 @@ test('should test and toggle volume control on `loadstart`', function(){
ok(muteToggle.el().className.indexOf('vjs-hidden') < 0,
'muteToggle is hidden initially');

player.tech['volumeControlFeature'] = false;
player.tech['featuresVolumeControl'] = false;
for (i = 0; i < listeners.length; i++) {
listeners[i]();
}
Expand All @@ -68,7 +68,7 @@ test('should test and toggle volume control on `loadstart`', function(){
ok(muteToggle.el().className.indexOf('vjs-hidden') >= 0,
'muteToggle does not hide itself');

player.tech['volumeControlFeature'] = true;
player.tech['featuresVolumeControl'] = true;
for (i = 0; i < listeners.length; i++) {
listeners[i]();
}
Expand Down
8 changes: 4 additions & 4 deletions test/unit/media.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
var noop = function() {}, clock, progessEventsFeature;
var noop = function() {}, clock, featuresProgessEvents;

module('Media Tech', {
'setup': function() {
clock = sinon.useFakeTimers();
progessEventsFeature = videojs.MediaTechController.prototype['progessEventsFeature'];
videojs.MediaTechController.prototype['progressEventsFeature'] = false;
featuresProgessEvents = videojs.MediaTechController.prototype['featuresProgessEvents'];
videojs.MediaTechController.prototype['featuresProgressEvents'] = false;
},
'teardown': function() {
clock.restore();
videojs.MediaTechController.prototype['progessEventsFeature'] = progessEventsFeature;
videojs.MediaTechController.prototype['featuresProgessEvents'] = featuresProgessEvents;
}
});

Expand Down

0 comments on commit f3925c7

Please sign in to comment.