Skip to content

Instantly share code, notes, and snippets.

@sb2702
Last active February 26, 2021 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sb2702/2049c691948c01b5aa35ff9cd2d887a7 to your computer and use it in GitHub Desktop.
Save sb2702/2049c691948c01b5aa35ff9cd2d887a7 to your computer and use it in GitHub Desktop.
Shaka Player Upscaling Integration
<head lang="en">
<script src="shaka-player.ui.js"></script>
<link rel="stylesheet" href="controls.css">
<script src="vectorly-shaka.js"></script>
</head>
<body>
<div id="container" data-shaka-player-container style="max-width:1280px;">
<video data-shaka-player crossorigin="anonymous" id="video" ></video>
</div>
<script>
const url = "video.mp4";
async function init() {
// When using the UI, the player is made automatically by the UI object.
const video = document.getElementById('video');
const ui = video['ui'];
const controls = ui.getControls();
const player = controls.getPlayer();
try {
await player.load(url);
// This runs if the asynchronous load is successful.
const upscaler = new vectorlyUpscaler.shakaPlugin(player, {width: 1280, height: 720});
} catch (error) {
console.log(error);
}
}
document.addEventListener('shaka-ui-loaded', init);
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment