1
0
mirror of https://github.com/videojs/video.js.git synced 2024-12-27 02:43:45 +02:00

Close GH-705: Changed tech.feature keys to strings to support external techs. closes #466.

This commit is contained in:
Steve Heffernan 2013-08-25 18:50:59 -07:00
parent 7c2ae3f68c
commit 92d16d6409
6 changed files with 22 additions and 22 deletions

View File

@ -12,11 +12,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.features && player.tech.features.volumeControl === false) {
if (player.tech && player.tech.features && player.tech.features['volumeControl'] === false) {
this.addClass('vjs-hidden');
}
player.on('loadstart', vjs.bind(this, function(){
if (player.tech.features && player.tech.features.volumeControl === false) {
if (player.tech.features && player.tech.features['volumeControl'] === false) {
this.addClass('vjs-hidden');
} else {
this.removeClass('vjs-hidden');
@ -66,4 +66,4 @@ vjs.MuteToggle.prototype.update = function(){
vjs.removeClass(this.el_, 'vjs-vol-'+i);
}
vjs.addClass(this.el_, 'vjs-vol-'+level);
};
};

View File

@ -10,11 +10,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.features && player.tech.features.volumeControl === false) {
if (player.tech && player.tech.features && player.tech.features['volumeControl'] === false) {
this.addClass('vjs-hidden');
}
player.on('loadstart', vjs.bind(this, function(){
if (player.tech.features && player.tech.features.volumeControl === false) {
if (player.tech.features && player.tech.features['volumeControl'] === false) {
this.addClass('vjs-hidden');
} else {
this.removeClass('vjs-hidden');
@ -131,4 +131,4 @@ vjs.VolumeLevel.prototype.createEl = function(){
return vjs.SliderHandle.prototype.createEl.call(this, 'div', {
className: 'vjs-volume-handle'
});
};
};

View File

@ -13,13 +13,13 @@ vjs.Html5 = vjs.MediaTechController.extend({
/** @constructor */
init: function(player, options, ready){
// volume cannot be changed from 1 on iOS
this.features.volumeControl = vjs.Html5.canControlVolume();
this.features['volumeControl'] = vjs.Html5.canControlVolume();
// In iOS, if you move a video element in the DOM, it breaks video playback.
this.features.movingMediaElementInDOM = !vjs.IS_IOS;
this.features['movingMediaElementInDOM'] = !vjs.IS_IOS;
// HTML video is able to automatically resize when going to fullscreen
this.features.fullscreenResize = true;
this.features['fullscreenResize'] = true;
vjs.MediaTechController.call(this, player, options, ready);
@ -72,7 +72,7 @@ vjs.Html5.prototype.createEl = function(){
// Check if this browser supports moving the element into the box.
// On the iPhone video will break if you move the element,
// So we have to create a brand new element.
if (!el || this.features.movingMediaElementInDOM === false) {
if (!el || this.features['movingMediaElementInDOM'] === false) {
// If the original tag is still there, remove it.
if (el) {

View File

@ -154,15 +154,15 @@ vjs.MediaTechController.prototype.onTap = function(){
};
vjs.MediaTechController.prototype.features = {
volumeControl: true,
'volumeControl': true,
// Resizing plugins using request fullscreen reloads the plugin
fullscreenResize: false,
'fullscreenResize': false,
// Optional events that we can manually mimic with timers
// currently not triggered by video-js-swf
progressEvents: false,
timeupdateEvents: false
'progressEvents': false,
'timeupdateEvents': false
};
vjs.media = {};

View File

@ -235,12 +235,12 @@ vjs.Player.prototype.loadTech = function(techName, source){
this.player_.triggerReady();
// Manually track progress in cases where the browser/flash player doesn't report it.
if (!this.features.progressEvents) {
if (!this.features['progressEvents']) {
this.player_.manualProgressOn();
}
// Manually track timeudpates in cases where the browser/flash player doesn't report it.
if (!this.features.timeupdateEvents) {
if (!this.features['timeupdateEvents']) {
this.player_.manualTimeUpdatesOn();
}
};
@ -305,7 +305,7 @@ vjs.Player.prototype.manualProgressOn = function(){
this.tech.one('progress', function(){
// Update known progress support for this playback technology
this.features.progressEvents = true;
this.features['progressEvents'] = true;
// Turn off manual progress tracking
this.player_.manualProgressOff();
@ -344,7 +344,7 @@ vjs.Player.prototype.manualTimeUpdatesOn = function(){
// Watch for native timeupdate event
this.tech.one('timeupdate', function(){
// Update known progress support for this playback technology
this.features.timeupdateEvents = true;
this.features['timeupdateEvents'] = true;
// Turn off manual progress tracking
this.player_.manualTimeUpdatesOff();
});

View File

@ -11,7 +11,7 @@ test('should hide volume control if it\'s not supported', function(){
ready: noop,
tech: {
features: {
volumeControl: false
'volumeControl': false
}
},
volume: function(){},
@ -43,7 +43,7 @@ test('should test and toggle volume control on `loadstart`', function(){
},
tech: {
features: {
volumeControl: true
'volumeControl': true
}
}
};
@ -56,7 +56,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.features.volumeControl = false;
player.tech.features['volumeControl'] = false;
for (i = 0; i < listeners.length; i++) {
listeners[i]();
}
@ -66,7 +66,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.features.volumeControl = true;
player.tech.features['volumeControl'] = true;
for (i = 0; i < listeners.length; i++) {
listeners[i]();
}