mirror of
https://github.com/videojs/video.js.git
synced 2024-11-26 08:51:09 +02:00
Changed to feature prefix over suffix to make it read more as a boolean
This commit is contained in:
parent
c90d7d36f6
commit
f3925c7364
@ -13,11 +13,11 @@ vjs.MuteToggle = vjs.Button.extend({
|
|||||||
player.on('volumechange', vjs.bind(this, this.update));
|
player.on('volumechange', vjs.bind(this, this.update));
|
||||||
|
|
||||||
// hide mute toggle if the current tech doesn't support volume control
|
// 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');
|
this.addClass('vjs-hidden');
|
||||||
}
|
}
|
||||||
player.on('loadstart', vjs.bind(this, function(){
|
player.on('loadstart', vjs.bind(this, function(){
|
||||||
if (player.tech['volumeControlFeature'] === false) {
|
if (player.tech['featuresVolumeControl'] === false) {
|
||||||
this.addClass('vjs-hidden');
|
this.addClass('vjs-hidden');
|
||||||
} else {
|
} else {
|
||||||
this.removeClass('vjs-hidden');
|
this.removeClass('vjs-hidden');
|
||||||
|
@ -72,7 +72,7 @@ vjs.PlaybackRateMenuButton.prototype.onClick = function(){
|
|||||||
|
|
||||||
vjs.PlaybackRateMenuButton.prototype.playbackRateSupported = function(){
|
vjs.PlaybackRateMenuButton.prototype.playbackRateSupported = function(){
|
||||||
return this.player().tech
|
return this.player().tech
|
||||||
&& this.player().tech['playbackRateFeature']
|
&& this.player().tech['featuresPlaybackRate']
|
||||||
&& this.player().options()['playbackRates']
|
&& this.player().options()['playbackRates']
|
||||||
&& this.player().options()['playbackRates'].length > 0
|
&& this.player().options()['playbackRates'].length > 0
|
||||||
;
|
;
|
||||||
|
@ -11,11 +11,11 @@ vjs.VolumeControl = vjs.Component.extend({
|
|||||||
vjs.Component.call(this, player, options);
|
vjs.Component.call(this, player, options);
|
||||||
|
|
||||||
// hide volume controls when they're not supported by the current tech
|
// 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');
|
this.addClass('vjs-hidden');
|
||||||
}
|
}
|
||||||
player.on('loadstart', vjs.bind(this, function(){
|
player.on('loadstart', vjs.bind(this, function(){
|
||||||
if (player.tech['volumeControlFeature'] === false) {
|
if (player.tech['featuresVolumeControl'] === false) {
|
||||||
this.addClass('vjs-hidden');
|
this.addClass('vjs-hidden');
|
||||||
} else {
|
} else {
|
||||||
this.removeClass('vjs-hidden');
|
this.removeClass('vjs-hidden');
|
||||||
|
@ -11,11 +11,11 @@ vjs.VolumeMenuButton = vjs.MenuButton.extend({
|
|||||||
player.on('volumechange', vjs.bind(this, this.update));
|
player.on('volumechange', vjs.bind(this, this.update));
|
||||||
|
|
||||||
// hide mute toggle if the current tech doesn't support volume control
|
// 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');
|
this.addClass('vjs-hidden');
|
||||||
}
|
}
|
||||||
player.on('loadstart', vjs.bind(this, function(){
|
player.on('loadstart', vjs.bind(this, function(){
|
||||||
if (player.tech['volumeControlFeature'] === false) {
|
if (player.tech['featuresVolumeControl'] === false) {
|
||||||
this.addClass('vjs-hidden');
|
this.addClass('vjs-hidden');
|
||||||
} else {
|
} else {
|
||||||
this.removeClass('vjs-hidden');
|
this.removeClass('vjs-hidden');
|
||||||
|
@ -121,11 +121,11 @@ goog.exportSymbol('videojs.CaptionsButton', vjs.CaptionsButton);
|
|||||||
goog.exportSymbol('videojs.ChaptersButton', vjs.ChaptersButton);
|
goog.exportSymbol('videojs.ChaptersButton', vjs.ChaptersButton);
|
||||||
|
|
||||||
goog.exportSymbol('videojs.MediaTechController', vjs.MediaTechController);
|
goog.exportSymbol('videojs.MediaTechController', vjs.MediaTechController);
|
||||||
goog.exportProperty(vjs.MediaTechController.prototype, 'volumeControlFeature', vjs.MediaTechController.prototype.volumeControlFeature);
|
goog.exportProperty(vjs.MediaTechController.prototype, 'featuresVolumeControl', vjs.MediaTechController.prototype.featuresVolumeControl);
|
||||||
goog.exportProperty(vjs.MediaTechController.prototype, 'fullscreenResizeFeature', vjs.MediaTechController.prototype.fullscreenResizeFeature);
|
goog.exportProperty(vjs.MediaTechController.prototype, 'featuresFullscreenResize', vjs.MediaTechController.prototype.featuresFullscreenResize);
|
||||||
goog.exportProperty(vjs.MediaTechController.prototype, 'playbackRateFeature', vjs.MediaTechController.prototype.playbackRateFeature);
|
goog.exportProperty(vjs.MediaTechController.prototype, 'featuresPlaybackRate', vjs.MediaTechController.prototype.featuresPlaybackRate);
|
||||||
goog.exportProperty(vjs.MediaTechController.prototype, 'progressEventsFeature', vjs.MediaTechController.prototype.progressEventsFeature);
|
goog.exportProperty(vjs.MediaTechController.prototype, 'featuresProgressEvents', vjs.MediaTechController.prototype.featuresProgressEvents);
|
||||||
goog.exportProperty(vjs.MediaTechController.prototype, 'timeupdateEventsFeature', vjs.MediaTechController.prototype.timeupdateEventsFeature);
|
goog.exportProperty(vjs.MediaTechController.prototype, 'featuresTimeupdateEvents', vjs.MediaTechController.prototype.featuresTimeupdateEvents);
|
||||||
goog.exportProperty(vjs.MediaTechController.prototype, 'setPoster', vjs.MediaTechController.prototype.setPoster);
|
goog.exportProperty(vjs.MediaTechController.prototype, 'setPoster', vjs.MediaTechController.prototype.setPoster);
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,19 +13,19 @@ vjs.Html5 = vjs.MediaTechController.extend({
|
|||||||
/** @constructor */
|
/** @constructor */
|
||||||
init: function(player, options, ready){
|
init: function(player, options, ready){
|
||||||
// volume cannot be changed from 1 on iOS
|
// 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...
|
// 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.
|
// In iOS, if you move a video element in the DOM, it breaks video playback.
|
||||||
this['movingMediaElementInDOM'] = !vjs.IS_IOS;
|
this['movingMediaElementInDOM'] = !vjs.IS_IOS;
|
||||||
|
|
||||||
// HTML video is able to automatically resize when going to fullscreen
|
// HTML video is able to automatically resize when going to fullscreen
|
||||||
this['fullscreenResizeFeature'] = true;
|
this['featuresFullscreenResize'] = true;
|
||||||
|
|
||||||
// HTML video supports progress events
|
// HTML video supports progress events
|
||||||
this['progressEventsFeature'] = true;
|
this['featuresProgressEvents'] = true;
|
||||||
|
|
||||||
vjs.MediaTechController.call(this, player, options, ready);
|
vjs.MediaTechController.call(this, player, options, ready);
|
||||||
this.setupTriggers();
|
this.setupTriggers();
|
||||||
|
@ -19,12 +19,12 @@ vjs.MediaTechController = vjs.Component.extend({
|
|||||||
vjs.Component.call(this, player, options, ready);
|
vjs.Component.call(this, player, options, ready);
|
||||||
|
|
||||||
// Manually track progress in cases where the browser/flash player doesn't report it.
|
// Manually track progress in cases where the browser/flash player doesn't report it.
|
||||||
if (!this['progressEventsFeature']) {
|
if (!this['featuresProgressEvents']) {
|
||||||
this.manualProgressOn();
|
this.manualProgressOn();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Manually track timeudpates in cases where the browser/flash player doesn't report it.
|
// Manually track timeudpates in cases where the browser/flash player doesn't report it.
|
||||||
if (!this['timeupdateEventsFeature']) {
|
if (!this['featuresTimeupdateEvents']) {
|
||||||
this.manualTimeUpdatesOn();
|
this.manualTimeUpdatesOn();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,7 +210,7 @@ vjs.MediaTechController.prototype.manualTimeUpdatesOn = function(){
|
|||||||
// Watch for native timeupdate event
|
// Watch for native timeupdate event
|
||||||
this.one('timeupdate', function(){
|
this.one('timeupdate', function(){
|
||||||
// Update known progress support for this playback technology
|
// Update known progress support for this playback technology
|
||||||
this['timeupdateEventsFeature'] = true;
|
this['featuresTimeupdateEvents'] = true;
|
||||||
// Turn off manual progress tracking
|
// Turn off manual progress tracking
|
||||||
this.manualTimeUpdatesOff();
|
this.manualTimeUpdatesOff();
|
||||||
});
|
});
|
||||||
@ -261,15 +261,15 @@ vjs.MediaTechController.prototype.setCurrentTime = function() {
|
|||||||
*/
|
*/
|
||||||
vjs.MediaTechController.prototype.setPoster = function(){};
|
vjs.MediaTechController.prototype.setPoster = function(){};
|
||||||
|
|
||||||
vjs.MediaTechController.prototype['volumeControlFeature'] = true;
|
vjs.MediaTechController.prototype['featuresVolumeControl'] = true;
|
||||||
|
|
||||||
// Resizing plugins using request fullscreen reloads the plugin
|
// Resizing plugins using request fullscreen reloads the plugin
|
||||||
vjs.MediaTechController.prototype['fullscreenResizeFeature'] = false;
|
vjs.MediaTechController.prototype['featuresFullscreenResize'] = false;
|
||||||
vjs.MediaTechController.prototype['playbackRateFeature'] = false;
|
vjs.MediaTechController.prototype['featuresPlaybackRate'] = false;
|
||||||
|
|
||||||
// Optional events that we can manually mimic with timers
|
// Optional events that we can manually mimic with timers
|
||||||
// currently not triggered by video-js-swf
|
// currently not triggered by video-js-swf
|
||||||
vjs.MediaTechController.prototype['progressEventsFeature'] = false;
|
vjs.MediaTechController.prototype['featuresProgressEvents'] = false;
|
||||||
vjs.MediaTechController.prototype['timeupdateEventsFeature'] = false;
|
vjs.MediaTechController.prototype['featuresTimeupdateEvents'] = false;
|
||||||
|
|
||||||
vjs.media = {};
|
vjs.media = {};
|
||||||
|
@ -1530,7 +1530,7 @@ vjs.Player.prototype.playbackRate = function(rate) {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.tech && this.tech['playbackRateFeature']) {
|
if (this.tech && this.tech['featuresPlaybackRate']) {
|
||||||
return this.techGet('playbackRate');
|
return this.techGet('playbackRate');
|
||||||
} else {
|
} else {
|
||||||
return 1.0;
|
return 1.0;
|
||||||
|
8
test/unit/controls.js
vendored
8
test/unit/controls.js
vendored
@ -12,7 +12,7 @@ test('should hide volume control if it\'s not supported', function(){
|
|||||||
language: noop,
|
language: noop,
|
||||||
languages: noop,
|
languages: noop,
|
||||||
tech: {
|
tech: {
|
||||||
'volumeControlFeature': false
|
'featuresVolumeControl': false
|
||||||
},
|
},
|
||||||
volume: function(){},
|
volume: function(){},
|
||||||
muted: function(){},
|
muted: function(){},
|
||||||
@ -45,7 +45,7 @@ test('should test and toggle volume control on `loadstart`', function(){
|
|||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
tech: {
|
tech: {
|
||||||
'volumeControlFeature': true
|
'featuresVolumeControl': true
|
||||||
},
|
},
|
||||||
reportUserActivity: function(){}
|
reportUserActivity: function(){}
|
||||||
};
|
};
|
||||||
@ -58,7 +58,7 @@ test('should test and toggle volume control on `loadstart`', function(){
|
|||||||
ok(muteToggle.el().className.indexOf('vjs-hidden') < 0,
|
ok(muteToggle.el().className.indexOf('vjs-hidden') < 0,
|
||||||
'muteToggle is hidden initially');
|
'muteToggle is hidden initially');
|
||||||
|
|
||||||
player.tech['volumeControlFeature'] = false;
|
player.tech['featuresVolumeControl'] = false;
|
||||||
for (i = 0; i < listeners.length; i++) {
|
for (i = 0; i < listeners.length; i++) {
|
||||||
listeners[i]();
|
listeners[i]();
|
||||||
}
|
}
|
||||||
@ -68,7 +68,7 @@ test('should test and toggle volume control on `loadstart`', function(){
|
|||||||
ok(muteToggle.el().className.indexOf('vjs-hidden') >= 0,
|
ok(muteToggle.el().className.indexOf('vjs-hidden') >= 0,
|
||||||
'muteToggle does not hide itself');
|
'muteToggle does not hide itself');
|
||||||
|
|
||||||
player.tech['volumeControlFeature'] = true;
|
player.tech['featuresVolumeControl'] = true;
|
||||||
for (i = 0; i < listeners.length; i++) {
|
for (i = 0; i < listeners.length; i++) {
|
||||||
listeners[i]();
|
listeners[i]();
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
var noop = function() {}, clock, progessEventsFeature;
|
var noop = function() {}, clock, featuresProgessEvents;
|
||||||
|
|
||||||
module('Media Tech', {
|
module('Media Tech', {
|
||||||
'setup': function() {
|
'setup': function() {
|
||||||
clock = sinon.useFakeTimers();
|
clock = sinon.useFakeTimers();
|
||||||
progessEventsFeature = videojs.MediaTechController.prototype['progessEventsFeature'];
|
featuresProgessEvents = videojs.MediaTechController.prototype['featuresProgessEvents'];
|
||||||
videojs.MediaTechController.prototype['progressEventsFeature'] = false;
|
videojs.MediaTechController.prototype['featuresProgressEvents'] = false;
|
||||||
},
|
},
|
||||||
'teardown': function() {
|
'teardown': function() {
|
||||||
clock.restore();
|
clock.restore();
|
||||||
videojs.MediaTechController.prototype['progessEventsFeature'] = progessEventsFeature;
|
videojs.MediaTechController.prototype['featuresProgessEvents'] = featuresProgessEvents;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user