Files
shaka-player/tutorials/sample2.txt
T
2014-12-19 14:26:19 -08:00

49 lines
1.4 KiB
Plaintext

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>TurtleTube - Autoplay</title>
<!-- Load the Shaka Player library. -->
<script src="shaka-player.compiled.js"></script>
</head>
<body>
<video id="video"
width="640" height="480"
crossorigin="anonymous"
controls
autoplay><!-- Start playing right away on load. -->
Your browser does not support HTML5 video.
</video>
</body>
<script>
function initPlayer() {
// Install polyfills.
shaka.polyfill.Fullscreen.install();
shaka.polyfill.MediaKeys.install();
shaka.polyfill.VideoPlaybackQuality.install();
// Find the video element.
var video = document.getElementById('video');
// Construct a Player to wrap around it.
var player = new shaka.player.Player(video);
// Attach the player to the window so that it can be easily debugged.
window.player = player;
// Listen for errors from the Player.
player.addEventListener('error', function(event) {
console.error(event);
});
// Construct a DashVideoSource to represent the DASH manifest.
var mpdUrl = 'http://turtle-tube.appspot.com/t/t2/dash.mpd';
var source = new shaka.player.DashVideoSource(mpdUrl, null);
// Load the source into the Player.
player.load(source);
}
document.addEventListener('DOMContentLoaded', initPlayer);
</script>
</html>