Skip to content

Commit

Permalink
fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
tchakabam committed Dec 3, 2017
1 parent d9d8dca commit bc6cff1
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 54 deletions.
1 change: 0 additions & 1 deletion src/controller/audio-stream-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import BinarySearch from '../utils/binary-search';
import BufferHelper from '../helper/buffer-helper';
import Demuxer from '../demux/demuxer';
import Event from '../events';
import EventHandler from '../event-handler';
import * as LevelHelper from '../helper/level-helper';import TimeRanges from '../utils/timeRanges';
import {ErrorTypes, ErrorDetails} from '../errors';
import {logger} from '../utils/logger';
Expand Down
47 changes: 21 additions & 26 deletions src/controller/eme-controller.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @author Stephan Hesse <[email protected]> | <[email protected]>
*
*
* DRM support for Hls.js
*/

Expand All @@ -13,7 +13,7 @@ import Event from '../events';
const KeySystems = {
WIDEVINE: 'com.widevine.alpha',
PLAYREADY: 'com.microsoft.playready'
}
};

/**
* @see https://developer.mozilla.org/en-US/docs/Web/API/MediaKeySystemConfiguration
Expand All @@ -22,13 +22,14 @@ const KeySystems = {
* @param {object} drmSystemOptions Optional parameters/requirements for the key-system
* @returns {Array<MediaSystemConfiguration>} An array of supported configurations
*/
const createWidevineMediaKeySystemConfigurations = function(audioCodecs, videoCodecs, drmSystemOptions) {

const createWidevineMediaKeySystemConfigurations = function(audioCodecs, videoCodecs, drmSystemOptions) { /* jshint ignore:line */
const baseConfig = {
//initDataTypes: ['keyids', 'mp4'],
//label: "",
//persistentState: "not-allowed", // or "required" ?
//distinctiveIdentifier: "not-allowed", // or "required" ?
//sessionTypes: ['temporary'],
//sessionTypes: ['temporary'],
videoCapabilities: [
//{ contentType: 'video/mp4; codecs="avc1.42E01E"' }
]
Expand All @@ -43,14 +44,14 @@ const createWidevineMediaKeySystemConfigurations = function(audioCodecs, videoCo
return [
baseConfig
];
}
};

/**
* The idea here is to handle key-system (and their respective platforms) specific configuration differences
* in order to work with the local requestMediaKeySystemAccess method.
*
*
* We can also rule-out platform-related key-system support at this point by throwing an error or returning null.
*
*
* @param {string} keySystem Identifier for the key-system, see `KeySystems` enum
* @param {Array<string>} audioCodecs List of required audio codecs to support
* @param {Array<string>} videoCodecs List of required video codecs to support
Expand All @@ -59,16 +60,16 @@ const createWidevineMediaKeySystemConfigurations = function(audioCodecs, videoCo
const getSupportedMediaKeySystemConfigurations = function(keySystem, audioCodecs, videoCodecs) {
switch(keySystem) {
case KeySystems.WIDEVINE:
return createWidevineMediaKeySystemConfigurations(audioCodecs, videoCodecs)
return createWidevineMediaKeySystemConfigurations(audioCodecs, videoCodecs);
default:
throw Error('Unknown key-system: ' + keySystem);
}
}
};

/**
* Controller to deal with encrypted media extensions (EME)
* @see https://developer.mozilla.org/en-US/docs/Web/API/Encrypted_Media_Extensions_API
*
*
* @class
* @constructor
*/
Expand All @@ -80,7 +81,6 @@ class EMEController extends EventHandler {
*/
constructor(hls) {
super(hls,
Event.MEDIA_ATTACHING,
Event.MEDIA_ATTACHED,
Event.MANIFEST_PARSED,
Event.LEVEL_SWITCHED
Expand Down Expand Up @@ -128,8 +128,8 @@ class EMEController extends EventHandler {

/**
* Handles obtaining access to a key-system
*
* @param {string} keySystem
*
* @param {string} keySystem
* @param {MediaKeySystemAccess} mediaKeySystemAccess https://developer.mozilla.org/en-US/docs/Web/API/MediaKeySystemAccess
*/
_onMediaKeySystemAccessObtained(keySystem, mediaKeySystemAccess) {
Expand Down Expand Up @@ -167,19 +167,19 @@ class EMEController extends EventHandler {
* for all existing keys where no session exists yet.
*/
_onMediaKeysCreated() {

// check for all key-list items if a session exists, otherwise, create one
this._mediaKeysList.forEach((mediaKeysListItem) => {
if(!mediaKeysListItem.mediaKeysSession) {
mediaKeysListItem.mediaKeysSession = mediaKeysListItem.mediaKeys.createSession();
this._onNewMediaKeySession(mediaKeysListItem.mediaKeysSession);
}
})
});
}

/**
*
* @param {*} keySession
*
* @param {*} keySession
*/
_onNewMediaKeySession(keySession) {
console.log('New key-system session:', keySession);
Expand All @@ -194,7 +194,7 @@ class EMEController extends EventHandler {

console.log('message:', message);

this._requestLicense(message, (data) => {
this._requestLicense(message, (data) => {
keySession.update(data);
});
}
Expand Down Expand Up @@ -276,7 +276,7 @@ class EMEController extends EventHandler {
console.log('_requestLicense');

let challenge;

const xhr = new XMLHttpRequest();
xhr.open('POST', url);
xhr.responseType = 'arraybuffer';
Expand Down Expand Up @@ -320,17 +320,12 @@ class EMEController extends EventHandler {
// For Widevine CDMs, the challenge is the keyMessage.
challenge = keyMessage;
} else {
console.error('Unsupported key-system:', mediaKeySystemDomain);
console.error('Unsupported key-system:', keysListItem.mediaKeySystemDomain);
}

xhr.send(challenge);
}

// Event handlers
onMediaAttaching(data) {
console.log('media attaching');
}

onMediaAttached(data) {
const media = data.media;

Expand Down Expand Up @@ -359,4 +354,4 @@ class EMEController extends EventHandler {
}
}

export default EMEController;
export default EMEController;
1 change: 0 additions & 1 deletion src/controller/stream-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import BinarySearch from '../utils/binary-search';
import BufferHelper from '../helper/buffer-helper';
import Demuxer from '../demux/demuxer';
import Event from '../events';
import EventHandler from '../event-handler';
import * as LevelHelper from '../helper/level-helper';import TimeRanges from '../utils/timeRanges';
import {ErrorTypes, ErrorDetails} from '../errors';
import {logger} from '../utils/logger';
Expand Down
1 change: 0 additions & 1 deletion src/controller/subtitle-stream-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/

import Event from '../events';
import EventHandler from '../event-handler';
import {logger} from '../utils/logger';
import Decrypter from '../crypt/decrypter';
import TaskLoop from '../task-loop';
Expand Down
5 changes: 3 additions & 2 deletions src/demux/mp4demuxer.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const UINT32_MAX = Math.pow(2, 32) - 1;
videoCodec = 'avc1.42e01e';

}
var tracks = {};
const tracks = {};
if(initData.audio && initData.video) {
tracks.audiovideo = { container : 'video/mp4', codec : audioCodec + ',' + videoCodec, initSegment : duration ? initSegment : null };
} else {
Expand Down Expand Up @@ -197,7 +197,7 @@ const UINT32_MAX = Math.pow(2, 32) - 1;
referenceIndex += 4;

const referenceSize = referenceInfo & 0x7FFFFFFF;
const referenceType = (referenceInfo & 0x80000000) >>> 31
const referenceType = (referenceInfo & 0x80000000) >>> 31;

if (referenceType === 1) {
console.warn('SIDX has hierarchical references (not supported)');
Expand Down Expand Up @@ -228,6 +228,7 @@ const UINT32_MAX = Math.pow(2, 32) - 1;
}

return {
earliestPresentationTime,
timescale,
version,
referencesCount,
Expand Down
4 changes: 2 additions & 2 deletions src/loader/m3u8-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default class M3U8Parser {
return matchingGroup;
}

static convertAVC1ToAVC_OTI(codec) {
static convertAVC1ToAVCOTI(codec) {
var result, avcdata = codec.split('.');
if (avcdata.length > 2) {
result = avcdata.shift() + '.';
Expand Down Expand Up @@ -100,7 +100,7 @@ export default class M3U8Parser {
setCodecs([].concat((attrs.CODECS || '').split(/[ ,]+/)), level);

if (level.videoCodec && level.videoCodec.indexOf('avc1') !== -1) {
level.videoCodec = M3U8Parser.convertAVC1ToAVC_OTI(level.videoCodec);
level.videoCodec = M3U8Parser.convertAVC1ToAVCOTI(level.videoCodec);
}

levels.push(level);
Expand Down
Loading

0 comments on commit bc6cff1

Please sign in to comment.