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

Changed tech.feature keys to strings to support external techs. closes #466 #705

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
6 changes: 3 additions & 3 deletions src/js/control-bar/mute-toggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -66,4 +66,4 @@ vjs.MuteToggle.prototype.update = function(){
vjs.removeClass(this.el_, 'vjs-vol-'+i);
}
vjs.addClass(this.el_, 'vjs-vol-'+level);
};
};
6 changes: 3 additions & 3 deletions src/js/control-bar/volume-control.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -131,4 +131,4 @@ vjs.VolumeLevel.prototype.createEl = function(){
return vjs.SliderHandle.prototype.createEl.call(this, 'div', {
className: 'vjs-volume-handle'
});
};
};
8 changes: 4 additions & 4 deletions src/js/media/html5.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions src/js/media/media.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
Expand Down
8 changes: 4 additions & 4 deletions src/js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
};
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
});
Expand Down
8 changes: 4 additions & 4 deletions test/unit/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(){},
Expand Down Expand Up @@ -43,7 +43,7 @@ test('should test and toggle volume control on `loadstart`', function(){
},
tech: {
features: {
volumeControl: true
'volumeControl': true
}
}
};
Expand All @@ -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]();
}
Expand All @@ -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]();
}
Expand Down