Skip to content

Instantly share code, notes, and snippets.

@HeNy007
Created January 1, 2023 23:29
Show Gist options
  • Save HeNy007/ef363f85d517aae374e423e530456f22 to your computer and use it in GitHub Desktop.
Save HeNy007/ef363f85d517aae374e423e530456f22 to your computer and use it in GitHub Desktop.
WaYvJQ
<div class="container">
<video controls crossorigin playsinline poster="https://ia800603.us.archive.org/30/items/Tears-of-Steel/tos-poster.jpg"></video>
</div>
<!-- Plyr resources and browser polyfills are specified in the pen settings -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/shaka-player/2.4.0/shaka-player.compiled.js">
document.addEventListener('DOMContentLoaded', () => {
const source = 'https://demo.unified-streaming.com/video/tears-of-steel/tears-of-steel-en.ism/.mpd';
const video = document.querySelector('video');
// For options (second argument) see: https://github.com/sampotts/plyr/#options
const player = new Plyr(video);
// Expose player so it can be used from the console
window.player = player;
// Install built-in polyfills
shaka.polyfill.installAll();
// For more Shaka Player options, see: https://github.com/google/shaka-player
if (shaka.Player.isBrowserSupported()) {
const shakaInstance = new shaka.Player(video);
shakaInstance.load(source);
} else {
console.warn('Browser is not supported!');
}
});
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=es6,Array.prototype.includes,CustomEvent,Object.entries,Object.values,URL"></script>
<script src="https://cdn.jsdelivr.net/npm/plyr@3"></script>
.container {
margin: 20px auto;
width: 600px;
height: 268px;
}
<link href="https://cdn.jsdelivr.net/npm/plyr@3/dist/plyr.css" rel="stylesheet" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment