Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove ie 11 support #160

Merged
merged 3 commits into from
Aug 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,038 changes: 1,005 additions & 1,033 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 3 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,17 @@
"@videojs/generator-helpers": "~2.0.1",
"jsdom": "^16.4.0",
"karma": "^5.2.3",
"rollup": "^2.36.1",
"rollup": "^2.38.0",
"rollup-plugin-string": "^3.0.0",
"sinon": "^9.2.3",
"videojs-generate-karma-config": "~7.0.0",
"videojs-generate-rollup-config": "^6.2.2",
"videojs-generate-karma-config": "^8.0.1",
"videojs-generate-rollup-config": "~7.0.0",
"videojs-generator-verify": "~3.0.2",
"videojs-standard": "^9.0.1"
},
"generator-videojs-plugin": {
"version": "7.7.3"
},
"browserslist": [
"defaults",
"ie 11"
],
"lint-staged": {
"*.js": "vjsstandard --fix",
"README.md": "doctoc --notitle"
Expand Down
19 changes: 11 additions & 8 deletions src/playlist-merge.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { forEachMediaGroup } from '@videojs/vhs-utils/es/media-groups';
import { findIndex, union } from './utils/list';
import { union } from './utils/list';

const SUPPORTED_MEDIA_TYPES = ['AUDIO', 'SUBTITLES'];
// allow one 60fps frame as leniency (arbitrarily chosen)
Expand Down Expand Up @@ -82,10 +82,11 @@ export const updateMediaSequenceForPlaylist = ({ playlist, mediaSequence }) => {
*/
export const updateSequenceNumbers = ({ oldPlaylists, newPlaylists, timelineStarts }) => {
newPlaylists.forEach((playlist) => {
playlist.discontinuitySequence = findIndex(
timelineStarts,
({ timeline }) => timeline === playlist.timeline
);
playlist.discontinuitySequence = timelineStarts.findIndex(function({
timeline
}) {
return timeline === playlist.timeline;
});

// Playlists NAMEs come from DASH Representation IDs, which are mandatory
// (see ISO_23009-1-2012 5.3.5.2).
Expand Down Expand Up @@ -116,9 +117,11 @@ export const updateSequenceNumbers = ({ oldPlaylists, newPlaylists, timelineStar
// Since we don't yet support early available timelines, we don't need to support
// playlists with no segments.
const firstNewSegment = playlist.segments[0];
const oldMatchingSegmentIndex = findIndex(oldPlaylist.segments, (oldSegment) =>
Math.abs(oldSegment.presentationTime - firstNewSegment.presentationTime) <
TIME_FUDGE);
const oldMatchingSegmentIndex = oldPlaylist.segments.findIndex(function(oldSegment) {
return (
Math.abs(oldSegment.presentationTime - firstNewSegment.presentationTime) < TIME_FUDGE
);
});

// No matching segment from the old playlist means the entire playlist was refreshed.
// In this case the media sequence should account for this update, and the new segments
Expand Down
8 changes: 6 additions & 2 deletions src/toM3u8.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { values } from './utils/object';
import { findIndex, findIndexes } from './utils/list';
import { findIndexes } from './utils/list';
import { addSidxSegmentsToPlaylist as addSidxSegmentsToPlaylist_ } from './segment/segmentBase';
import { byteRangeToString } from './segment/urlType';
import {
Expand Down Expand Up @@ -352,7 +352,11 @@ export const addMediaSequenceValues = (playlists, timelineStarts) => {
// increment all segments sequentially
playlists.forEach((playlist) => {
playlist.mediaSequence = 0;
playlist.discontinuitySequence = findIndex(timelineStarts, ({ timeline }) => timeline === playlist.timeline);
playlist.discontinuitySequence = timelineStarts.findIndex(function({
timeline
}) {
return timeline === playlist.timeline;
});

if (!playlist.segments) {
return;
Expand Down
34 changes: 0 additions & 34 deletions src/utils/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,40 +34,6 @@ export const findIndexes = (l, key) => l.reduce((a, e, i) => {
return a;
}, []);

/**
* Returns the first index that satisfies the matching function, or -1 if not found.
*
* Only necessary because of IE11 support.
*
* @param {Array} list - the list to search through
* @param {Function} matchingFunction - the matching function
*
* @return {number} the matching index or -1 if not found
*/
export const findIndex = (list, matchingFunction) => {
for (let i = 0; i < list.length; i++) {
if (matchingFunction(list[i])) {
return i;
}
}

return -1;
};

/**
* Returns whether the list contains the search element.
*
* Only necessary because of IE11 support.
*
* @param {Array} list - the list to search through
* @param {*} searchElement - the element to look for
*
* @return {boolean} whether the list includes the search element or not
*/
export const includes = (list, searchElement) => {
return list.some((element) => element === searchElement);
};

/**
* Returns a union of the included lists provided each element can be identified by a key.
*
Expand Down
24 changes: 1 addition & 23 deletions test/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import {
flatten,
range,
from,
findIndexes,
findIndex,
includes
findIndexes
} from '../src/utils/list';
import { findChildren, getContent } from '../src/utils/xml';
import {DOMParser} from '@xmldom/xmldom';
Expand Down Expand Up @@ -199,26 +197,6 @@ QUnit.test('indexes found', function(assert) {
], 'b'), [1, 2]);
});

QUnit.module('findIndex');

QUnit.test('match', function(assert) {
assert.equal(findIndex([2, 'b', 'a'], (el) => el === 'a'), 2, 'returned index');
});

QUnit.test('no match', function(assert) {
assert.equal(findIndex([], (el) => el === 'a'), -1, 'no match');
});

QUnit.module('includes');

QUnit.test('match', function(assert) {
assert.ok(includes([2, 'b', 'a'], 'a'), 'match found');
});

QUnit.test('no match', function(assert) {
assert.notOk(includes([], 'a'), 'no match');
});

QUnit.module('xml', {
beforeEach() {
const parser = new DOMParser();
Expand Down