Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add functional test for MPD patching * Add sample for MPD patching * Add new function to Typescript file and revert changes in package.json * Return right type in JSDoc * Change single teststream * Run tests on Chrome
- Loading branch information
Showing
13 changed files
with
260 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Live stream with MPD Patching</title> | ||
|
||
<script src="../../dist/dash.all.debug.js"></script> | ||
|
||
<!-- Bootstrap core CSS --> | ||
<link href="../lib/bootstrap/bootstrap.min.css" rel="stylesheet"> | ||
<link href="../lib/main.css" rel="stylesheet"> | ||
|
||
<style> | ||
video { | ||
width: 100%; | ||
} | ||
|
||
.clock { | ||
color: #000; | ||
font-size: 60pt | ||
} | ||
</style> | ||
|
||
<script class="code"> | ||
var outputContainer; | ||
|
||
function init() { | ||
var video, | ||
player, | ||
url = 'https://192-46-234-23.ip.linodeusercontent.com/livesim2/segtimeline_1/patch_60/testpic_2s/Manifest.mpd'; | ||
|
||
video = document.querySelector('video'); | ||
player = dashjs.MediaPlayer().create(); | ||
player.initialize(video, url, true); | ||
outputContainer = document.getElementById('output-container'); | ||
player.on('internalManifestLoaded', showEvent) | ||
} | ||
|
||
|
||
function showEvent(e) { | ||
outputContainer.innerHTML = ""; | ||
for (var name in e) { | ||
|
||
if (typeof e[name] != 'object') { | ||
log(' ' + name + ': ' + e[name]); | ||
} | ||
} | ||
for (name in e) { | ||
if (typeof e[name] == 'object') { | ||
log(' ' + name + ':'); | ||
for (name2 in e[name]) { | ||
log(' ' + name2 + ': ' + JSON.stringify(e[name][name2])); | ||
} | ||
} | ||
} | ||
} | ||
|
||
function log(msg) { | ||
msg = msg.length > 90 ? msg.substring(0, 90) + '...' : msg; | ||
outputContainer.innerHTML += msg + '\n'; | ||
outputContainer.scrollTop = outputContainer.scrollHeight; | ||
} | ||
</script> | ||
</head> | ||
<body> | ||
|
||
<main> | ||
<div class="container py-4"> | ||
<header class="pb-3 mb-4 border-bottom"> | ||
<img class="" | ||
src="../lib/img/dashjs-logo.png" | ||
width="200"> | ||
</header> | ||
<div class="row"> | ||
<div class="col-md-6"> | ||
<div class="h-100 p-5 bg-light border rounded-3"> | ||
<h3>Live stream with MPD Patching</h3> | ||
<p>Example showing how dash.js handles live streams with updates to the manifest file provided via | ||
MPD patches.</p> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="row mt-4"> | ||
<div class="col-md-7"> | ||
<video controls="true"></video> | ||
</div> | ||
</div> | ||
<div class="row mt-4"> | ||
<div class="col-md-12"> | ||
<div class="p-5 border rounded-3 mt-1"> | ||
<h4>Last MPD update</h4> | ||
<div id="output-container"> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col-md-12"> | ||
<div id="code-output"></div> | ||
</div> | ||
</div> | ||
<footer class="pt-3 mt-4 text-muted border-top"> | ||
© DASH-IF | ||
</footer> | ||
</div> | ||
</main> | ||
|
||
|
||
<script> | ||
document.addEventListener('DOMContentLoaded', function () { | ||
init(); | ||
}); | ||
</script> | ||
<script src="../highlighter.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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); | ||
}) | ||
|
||
}) | ||
}) |