Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html">
- <head>
- <title>Philips Initiator XML</title>
- <meta charset="utf-8">
- </head>
- <body>
- <div id="debug"
- style=" display: block; position: absolute; z-index: 9999; width: 1200px; height: 250px; background-color: #5cbb44; padding: 20px; font-size: 22px; color: white; opacity: 0.8"></div>
- <video id="videoid" height="720" width="1280" autoplay></video>
- <script>
- var url = '';
- var video;
- function initialize() {
- addLog('Hi!');
- video = document.getElementById('videoid');
- video.addEventListener('error', onVideoError, true);
- video.addEventListener("loadstart", function() {
- addLog('loadstart!');
- }, true);
- video.addEventListener("canplay", function() {
- addLog('canplay!');
- }, true);
- video.addEventListener("pause", function() {
- addLog('pause!');
- }, true);
- video.addEventListener("playing", function() {
- addLog('playing!');
- }, true);
- video.addEventListener("seeked", function() {
- addLog('seeked!');
- }, true);
- video.addEventListener("seeking", function() {
- addLog('seeking!');
- }, true);
- video.addEventListener("volumechange", function() {
- addLog('volumechange!');
- }, true);
- video.addEventListener("durationchange", function() {
- addLog('durationchange!');
- }, true);
- video.addEventListener("ended", function() {
- addLog('loadstart!');
- }, true);
- video.addEventListener("waiting",function() {
- addLog('waiting!');
- }, true);
- addVideoSourceAndPlay();
- }
- function addVideoSourceAndPlay() {
- addLog('create source with manifest');
- addLog(url);
- var source = document.createElement('source');
- source.setAttribute('src', url);
- source.setAttribute('type', 'application/vnd.ms-playready.initiator+xml');
- video.appendChild(source);
- addLog('try to play video');
- video.play();
- }
- function onVideoError(e) {
- addLog('Error!');
- addLog('network state: ' + video.networkState);
- if (video.error) {
- addLog('error code: ' + video.error.code);
- }
- }
- function addLog(message) {
- var debug = document.getElementById("debug");
- console.log(message);
- debug.innerHTML += message + '</br>';
- }
- function keyCodes(e) {
- var currentPosition = video.currentTime;
- if (e.keyCode == 49) {
- window.location.reload();
- } else if (e.keyCode == 415) {
- video.play();
- } else if (e.keyCode == 19) {
- video.pause();
- } else if (e.keyCode == 417) {
- video.currentTime = currentPosition + 10;
- } else if (e.keyCode == 412) {
- video.currentTime = currentPosition - 10;
- } else if (e.keyCode == 461) {
- window.close();
- }
- }
- addEventListener('keydown', keyCodes);
- addEventListener('load', initialize);
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement