Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2020
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.77 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html">
  3. <head>
  4. <title>Philips VOD MSS/PR</title>
  5. <meta charset="utf-8">
  6. </head>
  7. <body>
  8. <div id="debug"
  9. 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>
  10. <video id="videoid" height="720" width="1280" autoplay></video>
  11. <object id="drmplugin" type="application/oipfDrmAgent" style="visibility:hidden"></object>
  12.  
  13. <script>
  14.  
  15. var manifestUrl = 'http://teststreamsrv.vcdn.biz/s/1/o/112/v.ism/Manifest?v=1816&a=1818_en';
  16. var licenseServerUrl = 'http://drm-test.megogo.net/playready/rightsmanager.asmx?ref=/philips2012/o/112&debug';
  17.  
  18. var video;
  19. var source;
  20.  
  21. function initialize() {
  22. addLog('ver X');
  23. addLog('src: ' + manifestUrl);
  24. if (licenseServerUrl) {
  25. addLog('licenseServerUrl: ' + licenseServerUrl);
  26. }
  27.  
  28. if (window.oipfObjectFactory !== undefined) {
  29. addLog('is oipfDrmAgent supported = ' + window.oipfObjectFactory.isObjectSupported('application/oipfDrmAgent'));
  30. } else {
  31. addLog('oipfObjectFactory is undefined');
  32. }
  33.  
  34. video = document.getElementById('videoid');
  35.  
  36. video.addEventListener('error', onVideoError, true);
  37.  
  38. video.addEventListener("loadstart", function () {
  39. addLog('loadstart!');
  40. }, true);
  41. video.addEventListener("canplay", function () {
  42. addLog('canplay!');
  43. }, true);
  44. video.addEventListener("pause", function () {
  45. addLog('pause!');
  46. }, true);
  47. video.addEventListener("playing", function () {
  48. addLog('playing!');
  49. }, true);
  50. video.addEventListener("seeked", function () {
  51. addLog('seeked!');
  52. }, true);
  53. video.addEventListener("seeking", function () {
  54. addLog('seeking!');
  55. }, true);
  56. video.addEventListener("volumechange", function () {
  57. addLog('volumechange!');
  58. }, true);
  59. video.addEventListener("durationchange", function () {
  60. addLog('durationchange!');
  61. }, true);
  62. video.addEventListener("ended", function () {
  63. addLog('loadstart!');
  64. }, true);
  65. video.addEventListener("waiting", function () {
  66. addLog('waiting!');
  67. }, true);
  68.  
  69. if (licenseServerUrl && licenseServerUrl.length) {
  70. sendLicenceRequest();
  71. }
  72. //else {
  73. addVideoSourceAndPlay();
  74. //}
  75. }
  76.  
  77. function addVideoSourceAndPlay() {
  78. source = document.createElement('source');
  79. source.setAttribute('src', manifestUrl);
  80. source.setAttribute('type', 'application/vnd.ms-sstr+xml');
  81. video.appendChild(source);
  82. video.play();
  83. }
  84.  
  85. function onVideoError(e) {
  86. addLog('Error!');
  87. addLog('network state: ' + video.networkState);
  88. if (video.error) {
  89. addLog('error code: ' + video.error.code);
  90. }
  91. }
  92.  
  93. function sendLicenceRequest() {
  94. var DRMSystemID = 'urn:dvb:casystemid:19219';
  95. var pluginElement = document.getElementById('drmplugin');
  96. var xmlLicenceAcquisition = '<?xml version="1.0" encoding="utf-8"?>' +
  97. '<PlayReadyInitiator xmlns="http://schemas.microsoft.com/DRM/2007/03/protocols/">' +
  98. '<LicenseServerUriOverride>' +
  99. '<LA_URL>' + licenseServerUrl + '</LA_URL>' +
  100. '</LicenseServerUriOverride>' +
  101. '</PlayReadyInitiator>';
  102. var msgType = 'application/vnd.ms-playready.initiator+xml';
  103. pluginElement.onDRMMessageResult = HandleOnDRMMessageResult;
  104. pluginElement.onDRMRightsError = HandleOnDRMRightsError;
  105. pluginElement.onDRMSystemStatusChange = HandleDRMSystemStatusChange;
  106. pluginElement.onDRMSystemMessage = HandleDRMSystemMessage;
  107. try {
  108. pluginElement.sendDRMMessage(msgType, xmlLicenceAcquisition, DRMSystemID);
  109. } catch (error) {
  110. addLog('Runtime error sendDRMMessage');
  111. addLog(error);
  112. }
  113. }
  114.  
  115. function HandleOnDRMMessageResult(msgID, resultMsg, resultCode) {
  116. addLog("HandleOnDRMMessageResult code " + resultCode);
  117. //addVideoSourceAndPlay();
  118. }
  119.  
  120. function HandleOnDRMRightsError(errorState, contentID, DRMSystemID, rightsIssuerURL) {
  121. addLog('Error!');
  122. if (errorState == 0) {
  123. addLog('no license');
  124. } else if (errorState == 1) {
  125. addLog('invalid license');
  126. }
  127. addLog('drmErrorHandler errorState:' + errorState + ' contentID:' + contentID
  128. + ' DRMSystemID: ' + DRMSystemID + ' rightsIssuerURL: ' + rightsIssuerURL);
  129. }
  130.  
  131. function HandleDRMSystemStatusChange(DRMSystemID) {
  132. addLog('Status changed! ' + DRMSystemID);
  133. }
  134.  
  135. function HandleDRMSystemMessage(msg, DRMSystemID) {
  136. addLog('System message ' + msg + ', ' + DRMSystemID);
  137. }
  138.  
  139.  
  140. function escapeHTML(unsafeText) {
  141. var div = document.createElement('div');
  142. div.innerText = unsafeText;
  143. return div.innerHTML;
  144. }
  145.  
  146. function addLog(message) {
  147. var debug = document.getElementById("debug");
  148. console.log(message);
  149. debug.innerHTML += escapeHTML(message) + '</br>';
  150. }
  151.  
  152. addEventListener('load', initialize);
  153.  
  154. </script>
  155. </body>
  156. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement