Browse Source

Code review updates

pull/1212/head
Oshin Karamian 8 years ago
parent
commit
c51469a8cc
  1. 4
      src/playlist-selectors.js
  2. 8
      src/videojs-contrib-hls.js
  3. 4
      test/playlist-selectors.test.js

4
src/playlist-selectors.js

@ -374,9 +374,7 @@ export const lowestBitrateCompatibleVariantSelector = function() {
// filter out any playlists that have been excluded due to
// incompatible configurations or playback errors
const enabledPlaylists = playlists.filter(
playlist => Playlist.isEnabled(playlist)
);
const enabledPlaylists = playlists.filter(Playlist.isEnabled);
// Parse and assume that playlists with no video codec have no video
// (this is not necessarily true, although it is generally true).

8
src/videojs-contrib-hls.js

@ -285,8 +285,8 @@ class HlsHandler extends Component {
// If the bandwidth number is unchanged from the initial setting
// then this takes precedence over the enableLowInitialPlaylist option
this.options_.enableLowInitialPlaylist =
(this.options_.enableLowInitialPlaylist &&
this.options_.bandwidth === INITIAL_BANDWIDTH) || false;
this.options_.enableLowInitialPlaylist &&
this.options_.bandwidth === INITIAL_BANDWIDTH;
// grab options passed to player.src
['withCredentials', 'bandwidth'].forEach((option) => {
@ -331,9 +331,7 @@ class HlsHandler extends Component {
this.selectPlaylist ?
this.selectPlaylist.bind(this) : Hls.STANDARD_PLAYLIST_SELECTOR.bind(this);
this.masterPlaylistController_.selectInitialPlaylist =
this.selectInitialPlaylist ?
this.selectInitialPlaylist.bind(this) : Hls.INITIAL_PLAYLIST_SELECTOR.bind(this);
this.masterPlaylistController_.selectInitialPlaylist = Hls.INITIAL_PLAYLIST_SELECTOR.bind(this);
// re-expose some internal objects for backwards compatibility with < v2
this.playlists = this.masterPlaylistController_.masterPlaylistLoader_;

4
test/playlist-selectors.test.js

@ -140,7 +140,7 @@ test('lowestBitrateCompatibleVariantSelector picks lowest non-audio playlist',
'Selected lowest compatible playlist with video assets');
});
test('lowestBitrateCompatibleVariantSelector picks lowest audio rendition if no video exists',
test('lowestBitrateCompatibleVariantSelector return null if no video exists',
function(assert) {
this.hls.playlists.master.playlists = [
{ attributes: { BANDWIDTH: 50, CODECS: 'mp4a.40.2' } },
@ -151,5 +151,5 @@ test('lowestBitrateCompatibleVariantSelector picks lowest audio rendition if no
const testPlaylist = lowestBitrateCompatibleVariantSelector.call(this.hls);
assert.equal(testPlaylist, null,
'Selected lowest compatible playlist since no video assets exist');
'Returned null playlist since no video assets exist');
});
Loading…
Cancel
Save