Skip to content

Commit b528b61

Browse files
chore: remove IE11 support (#160)
BREAKING CHANGE: Internet Explorer is no longer supported.
1 parent cd75be1 commit b528b61

File tree

6 files changed

+1026
-1107
lines changed

6 files changed

+1026
-1107
lines changed

package-lock.json

Lines changed: 1005 additions & 1033 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,17 @@
6565
"@videojs/generator-helpers": "~2.0.1",
6666
"jsdom": "^16.4.0",
6767
"karma": "^5.2.3",
68-
"rollup": "^2.36.1",
68+
"rollup": "^2.38.0",
6969
"rollup-plugin-string": "^3.0.0",
7070
"sinon": "^9.2.3",
71-
"videojs-generate-karma-config": "~7.0.0",
72-
"videojs-generate-rollup-config": "^6.2.2",
71+
"videojs-generate-karma-config": "^8.0.1",
72+
"videojs-generate-rollup-config": "~7.0.0",
7373
"videojs-generator-verify": "~3.0.2",
7474
"videojs-standard": "^9.0.1"
7575
},
7676
"generator-videojs-plugin": {
7777
"version": "7.7.3"
7878
},
79-
"browserslist": [
80-
"defaults",
81-
"ie 11"
82-
],
8379
"lint-staged": {
8480
"*.js": "vjsstandard --fix",
8581
"README.md": "doctoc --notitle"

src/playlist-merge.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { forEachMediaGroup } from '@videojs/vhs-utils/es/media-groups';
2-
import { findIndex, union } from './utils/list';
2+
import { union } from './utils/list';
33

44
const SUPPORTED_MEDIA_TYPES = ['AUDIO', 'SUBTITLES'];
55
// allow one 60fps frame as leniency (arbitrarily chosen)
@@ -82,10 +82,11 @@ export const updateMediaSequenceForPlaylist = ({ playlist, mediaSequence }) => {
8282
*/
8383
export const updateSequenceNumbers = ({ oldPlaylists, newPlaylists, timelineStarts }) => {
8484
newPlaylists.forEach((playlist) => {
85-
playlist.discontinuitySequence = findIndex(
86-
timelineStarts,
87-
({ timeline }) => timeline === playlist.timeline
88-
);
85+
playlist.discontinuitySequence = timelineStarts.findIndex(function({
86+
timeline
87+
}) {
88+
return timeline === playlist.timeline;
89+
});
8990

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

123126
// No matching segment from the old playlist means the entire playlist was refreshed.
124127
// In this case the media sequence should account for this update, and the new segments

src/toM3u8.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { values } from './utils/object';
2-
import { findIndex, findIndexes } from './utils/list';
2+
import { findIndexes } from './utils/list';
33
import { addSidxSegmentsToPlaylist as addSidxSegmentsToPlaylist_ } from './segment/segmentBase';
44
import { byteRangeToString } from './segment/urlType';
55
import {
@@ -352,7 +352,11 @@ export const addMediaSequenceValues = (playlists, timelineStarts) => {
352352
// increment all segments sequentially
353353
playlists.forEach((playlist) => {
354354
playlist.mediaSequence = 0;
355-
playlist.discontinuitySequence = findIndex(timelineStarts, ({ timeline }) => timeline === playlist.timeline);
355+
playlist.discontinuitySequence = timelineStarts.findIndex(function({
356+
timeline
357+
}) {
358+
return timeline === playlist.timeline;
359+
});
356360

357361
if (!playlist.segments) {
358362
return;

src/utils/list.js

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -34,40 +34,6 @@ export const findIndexes = (l, key) => l.reduce((a, e, i) => {
3434
return a;
3535
}, []);
3636

37-
/**
38-
* Returns the first index that satisfies the matching function, or -1 if not found.
39-
*
40-
* Only necessary because of IE11 support.
41-
*
42-
* @param {Array} list - the list to search through
43-
* @param {Function} matchingFunction - the matching function
44-
*
45-
* @return {number} the matching index or -1 if not found
46-
*/
47-
export const findIndex = (list, matchingFunction) => {
48-
for (let i = 0; i < list.length; i++) {
49-
if (matchingFunction(list[i])) {
50-
return i;
51-
}
52-
}
53-
54-
return -1;
55-
};
56-
57-
/**
58-
* Returns whether the list contains the search element.
59-
*
60-
* Only necessary because of IE11 support.
61-
*
62-
* @param {Array} list - the list to search through
63-
* @param {*} searchElement - the element to look for
64-
*
65-
* @return {boolean} whether the list includes the search element or not
66-
*/
67-
export const includes = (list, searchElement) => {
68-
return list.some((element) => element === searchElement);
69-
};
70-
7137
/**
7238
* Returns a union of the included lists provided each element can be identified by a key.
7339
*

test/utils.test.js

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import {
44
flatten,
55
range,
66
from,
7-
findIndexes,
8-
findIndex,
9-
includes
7+
findIndexes
108
} from '../src/utils/list';
119
import { findChildren, getContent } from '../src/utils/xml';
1210
import {DOMParser} from '@xmldom/xmldom';
@@ -199,26 +197,6 @@ QUnit.test('indexes found', function(assert) {
199197
], 'b'), [1, 2]);
200198
});
201199

202-
QUnit.module('findIndex');
203-
204-
QUnit.test('match', function(assert) {
205-
assert.equal(findIndex([2, 'b', 'a'], (el) => el === 'a'), 2, 'returned index');
206-
});
207-
208-
QUnit.test('no match', function(assert) {
209-
assert.equal(findIndex([], (el) => el === 'a'), -1, 'no match');
210-
});
211-
212-
QUnit.module('includes');
213-
214-
QUnit.test('match', function(assert) {
215-
assert.ok(includes([2, 'b', 'a'], 'a'), 'match found');
216-
});
217-
218-
QUnit.test('no match', function(assert) {
219-
assert.notOk(includes([], 'a'), 'no match');
220-
});
221-
222200
QUnit.module('xml', {
223201
beforeEach() {
224202
const parser = new DOMParser();

0 commit comments

Comments
 (0)