metrics.html 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <!DOCTYPE html>
  2. <head>
  3. <title>hls.js metrics page</title>
  4. <link
  5. rel="stylesheet"
  6. href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"
  7. />
  8. <link
  9. rel="stylesheet"
  10. href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css"
  11. />
  12. <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
  13. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
  14. <script src="../node_modules/jsonpack/main.js"></script>
  15. </head>
  16. <body>
  17. <div class="header-container">
  18. <header class="wrapper clearfix">
  19. <h1 class="title">hls.js metrics page</h1>
  20. </header>
  21. </div>
  22. <pre id="HlsDate"></pre>
  23. <pre id="StreamPermalink"></pre>
  24. <input id="metricsData" class="innerControls" type="text" value="" />
  25. window size
  26. <div id="metricsButton">
  27. <button
  28. type="button"
  29. class="btn btn-xs btn-primary"
  30. onclick="timeRangeSetSliding(0)"
  31. >
  32. window ALL
  33. </button>
  34. <button
  35. type="button"
  36. class="btn btn-xs btn-primary"
  37. onclick="timeRangeSetSliding(2000)"
  38. >
  39. 2s
  40. </button>
  41. <button
  42. type="button"
  43. class="btn btn-xs btn-primary"
  44. onclick="timeRangeSetSliding(5000)"
  45. >
  46. 5s
  47. </button>
  48. <button
  49. type="button"
  50. class="btn btn-xs btn-primary"
  51. onclick="timeRangeSetSliding(10000)"
  52. >
  53. 10s
  54. </button>
  55. <button
  56. type="button"
  57. class="btn btn-xs btn-primary"
  58. onclick="timeRangeSetSliding(20000)"
  59. >
  60. 20s
  61. </button>
  62. <button
  63. type="button"
  64. class="btn btn-xs btn-primary"
  65. onclick="timeRangeSetSliding(30000)"
  66. >
  67. 30s
  68. </button>
  69. <button
  70. type="button"
  71. class="btn btn-xs btn-primary"
  72. onclick="timeRangeSetSliding(60000)"
  73. >
  74. 60s
  75. </button>
  76. <button
  77. type="button"
  78. class="btn btn-xs btn-primary"
  79. onclick="timeRangeSetSliding(120000)"
  80. >
  81. 120s</button
  82. ><br />
  83. <button
  84. type="button"
  85. class="btn btn-xs btn-primary"
  86. onclick="timeRangeZoomIn()"
  87. >
  88. Window Zoom In
  89. </button>
  90. <button
  91. type="button"
  92. class="btn btn-xs btn-primary"
  93. onclick="timeRangeZoomOut()"
  94. >
  95. Window Zoom Out</button
  96. ><br />
  97. <button
  98. type="button"
  99. class="btn btn-xs btn-primary"
  100. onclick="timeRangeSlideLeft()"
  101. >
  102. <<< Window Slide
  103. </button>
  104. <button
  105. type="button"
  106. class="btn btn-xs btn-primary"
  107. onclick="timeRangeSlideRight()"
  108. >
  109. Window Slide >>></button
  110. ><br />
  111. <button
  112. type="button"
  113. class="btn btn-xs btn-primary"
  114. onclick="windowStart=$('#windowStart').val()"
  115. >
  116. fixed window start(ms)
  117. </button>
  118. <input
  119. type="text"
  120. id="windowStart"
  121. defaultValue="0"
  122. size="8"
  123. onkeydown="if(window.event.keyCode=='13'){windowStart=$('#windowStart').val();}"
  124. />
  125. <button
  126. type="button"
  127. class="btn btn-xs btn-primary"
  128. onclick="windowEnd=$('#windowEnd').val()"
  129. >
  130. fixed window end(ms)
  131. </button>
  132. <input
  133. type="text"
  134. id="windowEnd"
  135. defaultValue="10000"
  136. size="8"
  137. onkeydown="if(window.event.keyCode=='13'){windowEnd=$('#windowEnd').val();}"
  138. /><br />
  139. <canvas
  140. id="bufferTimerange_c"
  141. width="640"
  142. height="100"
  143. style="border: 1px solid #000000"
  144. onmousedown="timeRangeCanvasonMouseDown(event)"
  145. onmousemove="timeRangeCanvasonMouseMove(event)"
  146. onmouseup="timeRangeCanvasonMouseUp(event)"
  147. onmouseout="timeRangeCanvasonMouseOut(event)"
  148. ;
  149. ></canvas>
  150. <canvas
  151. id="bitrateTimerange_c"
  152. width="640"
  153. height="100"
  154. style="border: 1px solid #000000"
  155. ;
  156. ></canvas>
  157. <canvas
  158. id="bufferWindow_c"
  159. width="640"
  160. height="100"
  161. style="border: 1px solid #000000"
  162. onmousemove="windowCanvasonMouseMove(event)"
  163. ;
  164. ></canvas>
  165. <canvas
  166. id="videoEvent_c"
  167. width="640"
  168. height="15"
  169. style="border: 1px solid #000000"
  170. ;
  171. ></canvas>
  172. <canvas
  173. id="loadEvent_c"
  174. width="640"
  175. height="15"
  176. style="border: 1px solid #000000"
  177. ;
  178. ></canvas
  179. ><br />
  180. </div>
  181. <script src="canvas.js"></script>
  182. <script src="metrics.js"></script>
  183. <script>
  184. $(document).ready(function () {
  185. $('#metricsData').change(function () {
  186. events = jsonpack.unpack(atob($('#metricsData').val()));
  187. updateMetrics();
  188. });
  189. });
  190. var data =
  191. location.search.split('data=')[1] || location.hash.split('data=')[1],
  192. events;
  193. if (data) {
  194. events = jsonpack.unpack(atob(decodeURIComponent(data)));
  195. updateMetrics();
  196. }
  197. function updateMetrics() {
  198. var hlsLink = new URL(
  199. 'index.html?src=' + encodeURIComponent(events.url),
  200. window.location.href
  201. ).href;
  202. var playlistLink = document.createElement('a');
  203. playlistLink.setAttribute('href', events.url);
  204. playlistLink.textContent = events.url;
  205. var replayLink = document.createElement('a');
  206. replayLink.setAttribute('href', hlsLink);
  207. replayLink.textContent = hlsLink;
  208. var fragment = document.createDocumentFragment();
  209. fragment.appendChild(document.createTextNode('playlist: '));
  210. fragment.appendChild(playlistLink);
  211. fragment.appendChild(document.createElement('br'));
  212. fragment.appendChild(document.createTextNode('replay: '));
  213. fragment.appendChild(replayLink);
  214. $('#StreamPermalink').html(fragment);
  215. $('#HlsDate').text('session Start Date:' + new Date(events.t0));
  216. metricsDisplayed = true;
  217. showMetrics();
  218. refreshCanvas();
  219. }
  220. </script>
  221. </body>