From d5d97fe6e721385c4ee7e12eeec6677e86ab4901 Mon Sep 17 00:00:00 2001 From: DispatchCommit Date: Wed, 17 Feb 2021 19:32:05 -0800 Subject: [PATCH] cleanup plugin code --- package.json | 1 - .../videojs-hls-quality-selector/plugin.js | 16 ++++------------ .../viewers/videoViewer/internal/videojs.jsx | 1 - 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index acd3d2e3f..c78c543c2 100644 --- a/package.json +++ b/package.json @@ -206,7 +206,6 @@ "video.js": "^7.10.1", "videojs-contrib-quality-levels": "^2.0.9", "videojs-event-tracking": "^1.0.1", - "videojs-hls-quality-selector": "^1.1.4", "villain-react": "^1.0.9", "wavesurfer.js": "^2.2.1", "webpack": "^4.28.4", diff --git a/ui/component/viewers/videoViewer/internal/plugins/videojs-hls-quality-selector/plugin.js b/ui/component/viewers/videoViewer/internal/plugins/videojs-hls-quality-selector/plugin.js index 1a253073a..df829b46b 100644 --- a/ui/component/viewers/videoViewer/internal/plugins/videojs-hls-quality-selector/plugin.js +++ b/ui/component/viewers/videoViewer/internal/plugins/videojs-hls-quality-selector/plugin.js @@ -8,7 +8,6 @@ const defaults = {}; // Cross-compatibility for Video.js 5 and 6. const registerPlugin = videojs.registerPlugin || videojs.plugin; -// const dom = videojs.dom || videojs; /** * VideoJS HLS Quality Selector Plugin class. @@ -25,8 +24,9 @@ class HlsQualitySelectorPlugin { this.player = player; this.config = options; + // Ensure dependencies are met if (!this.player.qualityLevels) { - console.warn(`WARNING: Missing video.js quality levels plugin (required)`); + console.error(`Error: Missing video.js quality levels plugin (required) - videojs-hls-quality-selector`); return; } @@ -42,23 +42,16 @@ class HlsQualitySelectorPlugin { // Listen for source changes this.player.on('loadedmetadata', (e) => { - console.log(`Loaded Metadata detected by plugin!`, e); this.updatePlugin(); }); } updatePlugin() { - console.log(`Updating Quality Selector...`); - - // If there is quality levels plugin and the HLS tech exists - // then continue. + // If there is the HLS tech if (this.getHls()) { - console.log('Show quality selector'); // Show quality selector this._qualityButton.show(); } else { - console.log('Hide quality selector'); - console.log('Source type does not support multiple qulaity levels...'); // Hide quality selector this._qualityButton.hide(); } @@ -84,7 +77,6 @@ class HlsQualitySelectorPlugin { * Adds the quality menu button to the player control bar. */ createQualityButton() { - const player = this.player; this._qualityButton = new ConcreteButton(player); @@ -145,7 +137,7 @@ class HlsQualitySelectorPlugin { }).length) { const levelItem = this.getQualityMenuItem.call(this, { label: levels[i].height + 'p', - value: levels[i].height + value: levels[i].height, }); levelItems.push(levelItem); diff --git a/ui/component/viewers/videoViewer/internal/videojs.jsx b/ui/component/viewers/videoViewer/internal/videojs.jsx index e504e8af1..796b241ec 100644 --- a/ui/component/viewers/videoViewer/internal/videojs.jsx +++ b/ui/component/viewers/videoViewer/internal/videojs.jsx @@ -8,7 +8,6 @@ import 'video.js/dist/alt/video-js-cdn.min.css'; import eventTracking from 'videojs-event-tracking'; import * as OVERLAY from './overlays'; import './plugins/videojs-mobile-ui/plugin'; -// import qualitySelector from 'videojs-hls-quality-selector'; import hlsQualitySelector from './plugins/videojs-hls-quality-selector/plugin'; import qualityLevels from 'videojs-contrib-quality-levels'; import isUserTyping from 'util/detect-typing';