Skip to content

Instantly share code, notes, and snippets.

@bitboxer
Created March 5, 2024 12:11
Show Gist options
  • Save bitboxer/ac86da9e80e57efaa338739f1ae373de to your computer and use it in GitHub Desktop.
Save bitboxer/ac86da9e80e57efaa338739f1ae373de to your computer and use it in GitHub Desktop.
index.html
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8" />
<title>Test Page</title>
<script src="https://cdn.dashjs.org/latest/dash.all.debug.js"></script>
<script class="code">
function init() {
var url = 'https://dash.akamaized.net/akamai/bbb_30fps/bbb_30fps.mpd#t=610';
var video = document.querySelector('video');
var player = dashjs.MediaPlayer().create();
player.initialize(video, url, true);
player.updateSettings({ 'debug': { 'logLevel': dashjs.Debug.LOG_LEVEL_DEBUG }})
player.on('error', (e) => {
console.error('DashJS Error');
console.warn(e);
});
player.on('public_keyStatusesChanged', (e) => {
console.error('DashJS keys');
const status = Array.from(e.data.getKeyStatuses().values());
const outputRestricted = status.every((value) => value === 'output-restricted');
console.warn('status', status);
console.warn('outputRestricted', outputRestricted);
});
player.on('playbackPlaying', (e) => {
console.log('DashJS PlaybackPlaying');
});
player.on('playbackEnded', (e) => {
console.log('DashJS playbackEnded');
});
player.on('playbackProgress', (e) => {
console.log('DashJS playbackProgress');
});
player.on('playbackEnded', (e) => {
console.log('DashJS playbackEnded');
});
player.on('playbackSeeked', (e) => {
console.log('DashJS playbackSeeked');
});
player.on('playbackTimeUpdated', (e) => {
console.log('DashJS playbackTimeUpdated');
});
console.log("whit seeking");
player.on('playbackSeeking', (e) => {
console.log('DashJS playbackSeeking');
console.log(e)
});
player.on('playbackSeeked', (e) => {
console.log('DashJS playbackSeeked');
console.log(e)
});
video.addEventListener('ended', function () {
console.log('html5 ended');
});
window.player = player;
}
</script>
<style>
video {
width: 640px;
height: 360px;
}
</style>
</head>
<body>
<div>
<video controls="true"></video>
</div>
<script>
document.addEventListener('DOMContentLoaded', function () {
init();
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment