/
mpd-patching.js
55 lines (42 loc) · 1.99 KB
/
mpd-patching.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import Constants from '../../src/Constants.js';
import Utils from '../../src/Utils.js';
import {expect} from 'chai'
import {checkIsPlaying, checkIsProgressing, checkNoCriticalErrors, initializeDashJsAdapter} from '../common/common.js';
const TESTCASE = Constants.TESTCASES.FEATURE_SUPPORT.MPD_PATCHING;
Utils.getTestvectorsForTestcase(TESTCASE).forEach((item) => {
const mpd = item.url;
describe(`${TESTCASE} - ${item.name} - ${mpd}`, function () {
let playerAdapter
before(function () {
if (item.type === Constants.CONTENT_TYPES.VOD || !item.testdata || !item.testdata.mpdPatching) {
this.skip();
}
playerAdapter = initializeDashJsAdapter(item, mpd);
})
after(() => {
if (playerAdapter) {
playerAdapter.destroy();
}
})
it(`Checking playing state`, async () => {
await checkIsPlaying(playerAdapter, true);
})
it(`Checking progressing state`, async () => {
await checkIsProgressing(playerAdapter);
});
it(`Two consecutive manifest updates shall be of type Patch`, async () => {
const manifest = playerAdapter.getManifest();
const minimumUpdatePeriodInMs = parseInt(manifest.minimumUpdatePeriod) * 1000;
let manifestUpdateEvent = await playerAdapter.waitForEventAndGetPayload(minimumUpdatePeriodInMs * 2, 'internalManifestLoaded')
expect(manifestUpdateEvent.manifest.tagName).to.be.equal('Patch')
manifestUpdateEvent = await playerAdapter.waitForEventAndGetPayload(minimumUpdatePeriodInMs * 2, 'internalManifestLoaded')
expect(manifestUpdateEvent.manifest.tagName).to.be.equal('Patch')
});
it(`Should still be progressing`, async () => {
await checkIsProgressing(playerAdapter);
});
it(`Expect no critical errors to be thrown`, () => {
checkNoCriticalErrors(playerAdapter);
})
})
})