Created
January 1, 2023 23:29
-
-
Save HeNy007/ef363f85d517aae374e423e530456f22 to your computer and use it in GitHub Desktop.
WaYvJQ
This file contains hidden or 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
<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"> |
This file contains hidden or 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
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!'); | |
} | |
}); |
This file contains hidden or 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
<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> |
This file contains hidden or 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
.container { | |
margin: 20px auto; | |
width: 600px; | |
height: 268px; | |
} |
This file contains hidden or 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
<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