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 VOD MSS/PR</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>
- <object id="drmplugin" type="application/oipfDrmAgent" style="visibility:hidden"></object>
- <script>
- var manifestUrl = 'http://teststreamsrv.vcdn.biz/s/1/o/112/v.ism/Manifest?v=1816&a=1818_en';
- var licenseServerUrl = 'http://drm-test.megogo.net/playready/rightsmanager.asmx?ref=/philips2012/o/112&debug';
- var video;
- var source;
- function initialize() {
- addLog('ver X');
- addLog('src: ' + manifestUrl);
- if (licenseServerUrl) {
- addLog('licenseServerUrl: ' + licenseServerUrl);
- }
- if (window.oipfObjectFactory !== undefined) {
- addLog('is oipfDrmAgent supported = ' + window.oipfObjectFactory.isObjectSupported('application/oipfDrmAgent'));
- } else {
- addLog('oipfObjectFactory is undefined');
- }
- 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);
- if (licenseServerUrl && licenseServerUrl.length) {
- sendLicenceRequest();
- }
- //else {
- addVideoSourceAndPlay();
- //}
- }
- function addVideoSourceAndPlay() {
- source = document.createElement('source');
- source.setAttribute('src', manifestUrl);
- source.setAttribute('type', 'application/vnd.ms-sstr+xml');
- video.appendChild(source);
- video.play();
- }
- function onVideoError(e) {
- addLog('Error!');
- addLog('network state: ' + video.networkState);
- if (video.error) {
- addLog('error code: ' + video.error.code);
- }
- }
- function sendLicenceRequest() {
- var DRMSystemID = 'urn:dvb:casystemid:19219';
- var pluginElement = document.getElementById('drmplugin');
- var xmlLicenceAcquisition = '<?xml version="1.0" encoding="utf-8"?>' +
- '<PlayReadyInitiator xmlns="http://schemas.microsoft.com/DRM/2007/03/protocols/">' +
- '<LicenseServerUriOverride>' +
- '<LA_URL>' + licenseServerUrl + '</LA_URL>' +
- '</LicenseServerUriOverride>' +
- '</PlayReadyInitiator>';
- var msgType = 'application/vnd.ms-playready.initiator+xml';
- pluginElement.onDRMMessageResult = HandleOnDRMMessageResult;
- pluginElement.onDRMRightsError = HandleOnDRMRightsError;
- pluginElement.onDRMSystemStatusChange = HandleDRMSystemStatusChange;
- pluginElement.onDRMSystemMessage = HandleDRMSystemMessage;
- try {
- pluginElement.sendDRMMessage(msgType, xmlLicenceAcquisition, DRMSystemID);
- } catch (error) {
- addLog('Runtime error sendDRMMessage');
- addLog(error);
- }
- }
- function HandleOnDRMMessageResult(msgID, resultMsg, resultCode) {
- addLog("HandleOnDRMMessageResult code " + resultCode);
- //addVideoSourceAndPlay();
- }
- function HandleOnDRMRightsError(errorState, contentID, DRMSystemID, rightsIssuerURL) {
- addLog('Error!');
- if (errorState == 0) {
- addLog('no license');
- } else if (errorState == 1) {
- addLog('invalid license');
- }
- addLog('drmErrorHandler errorState:' + errorState + ' contentID:' + contentID
- + ' DRMSystemID: ' + DRMSystemID + ' rightsIssuerURL: ' + rightsIssuerURL);
- }
- function HandleDRMSystemStatusChange(DRMSystemID) {
- addLog('Status changed! ' + DRMSystemID);
- }
- function HandleDRMSystemMessage(msg, DRMSystemID) {
- addLog('System message ' + msg + ', ' + DRMSystemID);
- }
- function escapeHTML(unsafeText) {
- var div = document.createElement('div');
- div.innerText = unsafeText;
- return div.innerHTML;
- }
- function addLog(message) {
- var debug = document.getElementById("debug");
- console.log(message);
- debug.innerHTML += escapeHTML(message) + '</br>';
- }
- addEventListener('load', initialize);
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement