Skip to content

Commit

Permalink
Made tech related functions clearly private in the player
Browse files Browse the repository at this point in the history
This is important for enforcing the model that techs should
work the same for everything.

closes #2590
fixes #2060

- Made techGet and techCall private functions
- Made loadTech, techName, and unloadTech private
- Cleaned up all other private method naming in the player
- Removed some unneeded comments
  • Loading branch information
heff committed Sep 15, 2015
1 parent 50bb454 commit f7466af
Show file tree
Hide file tree
Showing 13 changed files with 312 additions and 279 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ CHANGELOG
* @heff added a fancy loading spinner ([view](https://github.com/videojs/video.js/pull/2582))
* @gkatsev added a mouse-hover time display to the progress bar ([view](https://github.com/videojs/video.js/pull/2569))
* @heff added an attributes argument to createEl() ([view](https://github.com/videojs/video.js/pull/2589))
* @heff made tech related functions private in the player ([view](https://github.com/videojs/video.js/pull/2590))

--------------------

Expand Down
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 @@ -21,14 +21,14 @@ class MuteToggle extends Button {
this.on(player, 'volumechange', this.update);

// hide mute toggle if the current tech doesn't support volume control
if (player.tech && player.tech['featuresVolumeControl'] === false) {
if (player.tech_ && player.tech_['featuresVolumeControl'] === false) {
this.addClass('vjs-hidden');
}

this.on(player, 'loadstart', function() {
this.update(); // We need to update the button to account for a default muted state.

if (player.tech['featuresVolumeControl'] === false) {
if (player.tech_['featuresVolumeControl'] === false) {
this.addClass('vjs-hidden');
} else {
this.removeClass('vjs-hidden');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ class PlaybackRateMenuButton extends MenuButton {
* @method playbackRateSupported
*/
playbackRateSupported() {
return this.player().tech
&& this.player().tech['featuresPlaybackRate']
return this.player().tech_
&& this.player().tech_['featuresPlaybackRate']
&& this.playbackRates()
&& this.playbackRates().length > 0
;
Expand Down
4 changes: 2 additions & 2 deletions src/js/control-bar/text-track-controls/captions-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class CaptionsButton extends TextTrackButton {
super.update();

// if native, then threshold is 1 because no settings button
if (this.player().tech && this.player().tech['featuresNativeTextTracks']) {
if (this.player().tech_ && this.player().tech_['featuresNativeTextTracks']) {
threshold = 1;
}

Expand All @@ -61,7 +61,7 @@ class CaptionsButton extends TextTrackButton {
createItems() {
let items = [];

if (!(this.player().tech && this.player().tech['featuresNativeTextTracks'])) {
if (!(this.player().tech_ && this.player().tech_['featuresNativeTextTracks'])) {
items.push(new CaptionSettingsMenuItem(this.player_, { 'kind': this.kind_ }));
}

Expand Down
4 changes: 2 additions & 2 deletions src/js/control-bar/volume-control/volume-control.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ class VolumeControl extends Component {
super(player, options);

// hide volume controls when they're not supported by the current tech
if (player.tech && player.tech['featuresVolumeControl'] === false) {
if (player.tech_ && player.tech_['featuresVolumeControl'] === false) {
this.addClass('vjs-hidden');
}
this.on(player, 'loadstart', function(){
if (player.tech['featuresVolumeControl'] === 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/volume-menu-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class VolumeMenuButton extends MenuButton {

// hide mute toggle if the current tech doesn't support volume control
function updateVisibility() {
if (player.tech && player.tech['featuresVolumeControl'] === false) {
if (player.tech_ && player.tech_['featuresVolumeControl'] === false) {
this.addClass('vjs-hidden');
} else {
this.removeClass('vjs-hidden');
Expand Down
Loading

0 comments on commit f7466af

Please sign in to comment.