Skip to content

Commit ebb61c2

Browse files
committed
Add functional test to test dynamic to static transition
1 parent 8c77af5 commit ebb61c2

File tree

4 files changed

+80
-0
lines changed

4 files changed

+80
-0
lines changed

test/functional/config/test-configurations/streams/smoke.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,19 @@
352352
"testdata": {
353353
"forcedSubtitles": {}
354354
}
355+
},
356+
{
357+
"name": "Dynamic to static transition with LiveSim2",
358+
"type": "live",
359+
"url": "https://livesim2.dashif.org/livesim2/stoprel_5/testpic_2s/Manifest.mpd",
360+
"includedTestfiles": [
361+
"feature-support/dynamic-to-static"
362+
],
363+
"testdata": {
364+
"dynamicToStatic": {
365+
"runtime": 20000
366+
}
367+
}
355368
}
356369
]
357370
}

test/functional/src/Constants.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ TESTCASES.FEATURE_SUPPORT.EMSG_TRIGGERED = TESTCASES.CATEGORIES.FEATURE_SUPPORT
164164
TESTCASES.FEATURE_SUPPORT.MPD_PATCHING = TESTCASES.CATEGORIES.FEATURE_SUPPORT + 'mpd-patching';
165165
TESTCASES.FEATURE_SUPPORT.CMCD = TESTCASES.CATEGORIES.FEATURE_SUPPORT + 'cmcd';
166166
TESTCASES.FEATURE_SUPPORT.ANNEX_I = TESTCASES.CATEGORIES.FEATURE_SUPPORT + 'annex-i';
167+
TESTCASES.FEATURE_SUPPORT.DYNAMIC_TO_STATIC = TESTCASES.CATEGORIES.FEATURE_SUPPORT + 'dynamic-to-static';
167168

168169
TESTCASES.LIVE.CATCHUP = TESTCASES.CATEGORIES.LIVE + 'latency-catchup';
169170
TESTCASES.LIVE.DELAY = TESTCASES.CATEGORIES.LIVE + 'live-delay';

test/functional/test/common/common.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ export function initializeDashJsAdapterForPreload(item, mpd, settings) {
106106
return playerAdapter
107107
}
108108

109+
export function playForDuration(durationInMilliseconds) {
110+
return new Promise(resolve => setTimeout(resolve, durationInMilliseconds));
111+
}
109112

110113
export function isLiveContent(item) {
111114
return item.type === Constants.CONTENT_TYPES.LIVE
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import Constants from '../../src/Constants.js';
2+
import Utils from '../../src/Utils.js';
3+
import {
4+
checkEventHasBeenTriggered,
5+
checkIsPlaying,
6+
checkIsProgressing,
7+
checkNoCriticalErrors,
8+
initializeDashJsAdapterWithoutAttachSource,
9+
playForDuration
10+
} from '../common/common.js';
11+
12+
const TESTCASE = Constants.TESTCASES.FEATURE_SUPPORT.DYNAMIC_TO_STATIC;
13+
14+
Utils.getTestvectorsForTestcase(TESTCASE).forEach((item) => {
15+
const mpd = item.url;
16+
17+
describe(`${TESTCASE} - ${item.name} - ${mpd}`, function () {
18+
19+
let playerAdapter
20+
21+
before(function () {
22+
if (item.type === Constants.CONTENT_TYPES.VOD || !item.testdata || !item.testdata.dynamicToStatic || isNaN(item.testdata.dynamicToStatic.runtime)) {
23+
this.skip();
24+
}
25+
playerAdapter = initializeDashJsAdapterWithoutAttachSource(item);
26+
playerAdapter.registerEvent(dashjs.MediaPlayer.events.DYNAMIC_TO_STATIC);
27+
playerAdapter.registerEvent(dashjs.MediaPlayer.events.PLAYBACK_ENDED);
28+
playerAdapter.attachSource(mpd);
29+
})
30+
31+
after(() => {
32+
if (playerAdapter) {
33+
playerAdapter.destroy();
34+
}
35+
})
36+
37+
it(`Checking playing state`, async () => {
38+
await checkIsPlaying(playerAdapter, true);
39+
})
40+
41+
it(`Checking progressing state`, async () => {
42+
await checkIsProgressing(playerAdapter);
43+
});
44+
45+
it(`Play for the defined runtime`, async () => {
46+
const runtime = item.testdata.dynamicToStatic.runtime;
47+
await playForDuration(runtime)
48+
});
49+
50+
it(`DYNAMIC_TO_STATIC event has been thrown`, async () => {
51+
checkEventHasBeenTriggered(playerAdapter, dashjs.MediaPlayer.events.DYNAMIC_TO_STATIC);
52+
});
53+
54+
it(`PLAYBACK_ENDED event has been thrown`, async () => {
55+
checkEventHasBeenTriggered(playerAdapter, dashjs.MediaPlayer.events.PLAYBACK_ENDED);
56+
});
57+
58+
it(`Expect no critical errors to be thrown`, () => {
59+
checkNoCriticalErrors(playerAdapter);
60+
})
61+
62+
})
63+
})

0 commit comments

Comments
 (0)