Skip to content

Commit

Permalink
Remove Map / Update BCP-47 Libraries (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShiningTrapez authored Oct 5, 2023
1 parent ba5903d commit 5537d30
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 68 deletions.
104 changes: 52 additions & 52 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
"yargs": "16.0.3"
},
"dependencies": {
"bcp-47-match": "^1.0.3",
"bcp-47-normalize": "^1.1.1",
"bcp-47-match": "^2.0.3",
"bcp-47-normalize": "^2.3.0",
"codem-isoboxer": "0.3.9",
"es6-promise": "^4.2.8",
"fast-deep-equal": "2.0.1",
Expand Down
10 changes: 5 additions & 5 deletions src/dash/DashAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import Event from './vo/Event';
import FactoryMaker from '../core/FactoryMaker';
import DashManifestModel from './models/DashManifestModel';
import PatchManifestModel from './models/PatchManifestModel';
import bcp47Normalize from 'bcp-47-normalize';
import {bcp47Normalize} from 'bcp-47-normalize';

/**
* @module DashAdapter
Expand Down Expand Up @@ -1045,7 +1045,7 @@ function DashAdapter() {
viewpoint = dashManifestModel.getViewpointForAdaptation(realAdaptation);
mediaInfo.viewpoint = viewpoint.length ? viewpoint[0].value : undefined;
mediaInfo.viewpointsWithSchemeIdUri = viewpoint;

accessibility = dashManifestModel.getAccessibilityForAdaptation(realAdaptation);
mediaInfo.accessibility = accessibility.map(function (accessibility) {
let accessibilityValue = accessibility.value;
Expand Down Expand Up @@ -1075,13 +1075,13 @@ function DashAdapter() {
});
mediaInfo.audioChannelConfigurationsWithSchemeIdUri = acc_rep;
}

roles = dashManifestModel.getRolesForAdaptation(realAdaptation);
mediaInfo.roles = roles.map(function (role) {
return role.value;
});
mediaInfo.rolesWithSchemeIdUri = roles;

mediaInfo.codec = dashManifestModel.getCodec(realAdaptation);
mediaInfo.mimeType = dashManifestModel.getMimeType(realAdaptation);
mediaInfo.contentProtection = dashManifestModel.getContentProtectionData(realAdaptation);
Expand Down Expand Up @@ -1120,7 +1120,7 @@ function DashAdapter() {
mediaInfo.supplementalPropertiesAsArray = arr[0];
}
}

mediaInfo.isFragmented = dashManifestModel.getIsFragmented(realAdaptation);
mediaInfo.isEmbedded = false;

Expand Down
2 changes: 1 addition & 1 deletion src/dash/parser/matchers/LangMatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*/
import BaseMatcher from './BaseMatcher';
import DashConstants from '../../constants/DashConstants';
import bcp47Normalize from 'bcp-47-normalize';
import {bcp47Normalize} from 'bcp-47-normalize';

class LangMatcher extends BaseMatcher {
constructor() {
Expand Down
2 changes: 1 addition & 1 deletion src/streaming/controllers/MediaController.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import Events from '../../core/events/Events';
import EventBus from '../../core/EventBus';
import FactoryMaker from '../../core/FactoryMaker';
import Debug from '../../core/Debug';
import bcp47Normalize from 'bcp-47-normalize';
import {bcp47Normalize} from 'bcp-47-normalize';
import {extendedFilter} from 'bcp-47-match';

function MediaController() {
Expand Down
17 changes: 10 additions & 7 deletions src/streaming/models/VideoModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,16 @@ import Debug from '../../core/Debug';
import Constants from '../constants/Constants';
import Settings from '../../core/Settings';

const READY_STATES_TO_EVENT_NAMES = function () {
const ret = {};

const READY_STATES_TO_EVENT_NAMES = new Map([
[Constants.VIDEO_ELEMENT_READY_STATES.HAVE_METADATA, 'loadedmetadata'],
[Constants.VIDEO_ELEMENT_READY_STATES.HAVE_CURRENT_DATA, 'loadeddata'],
[Constants.VIDEO_ELEMENT_READY_STATES.HAVE_FUTURE_DATA, 'canplay'],
[Constants.VIDEO_ELEMENT_READY_STATES.HAVE_ENOUGH_DATA, 'canplaythrough']
]);
ret[Constants.VIDEO_ELEMENT_READY_STATES.HAVE_METADATA] = 'loadedmetadata';
ret[Constants.VIDEO_ELEMENT_READY_STATES.HAVE_CURRENT_DATA] = 'loadeddata';
ret[Constants.VIDEO_ELEMENT_READY_STATES.HAVE_FUTURE_DATA] = 'canplay';
ret[Constants.VIDEO_ELEMENT_READY_STATES.HAVE_ENOUGH_DATA] = 'canplaythrough';

return ret;
}();

function VideoModel() {

Expand Down Expand Up @@ -447,7 +450,7 @@ function VideoModel() {
callback();
} else {
// wait for the appropriate callback before checking again
const event = READY_STATES_TO_EVENT_NAMES.get(targetReadyState);
const event = READY_STATES_TO_EVENT_NAMES[targetReadyState];
_listenOnce(event, callback);
}
}
Expand Down

0 comments on commit 5537d30

Please sign in to comment.