Web UI for ARGUS server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
2.5 KiB

6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <html>
  2. <head>
  3. <script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
  4. <!-- Or if you want a more recent canary version -->
  5. <!-- <script src="https://cdn.jsdelivr.net/npm/hls.js@canary"></script> -->
  6. <script>
  7. var video = document.getElementById('video');
  8. if( Hls.isSupported()) {
  9. alert("HLS is OK");
  10. var hls = new Hls();
  11. hls.loadSource('https://video-dev.github.io/streams/x36xhzz/x36xhzz.m3u8');
  12. hls.attachMedia(video);
  13. hls.on(Hls.Events.MANIFEST_PARSED,function() {
  14. video.play();
  15. });
  16. }
  17. // hls.js is not supported on platforms that do not have Media Source Extensions (MSE) enabled.
  18. // When the browser has built-in HLS support (check using `canPlayType`), we can provide an HLS manifest (i.e. .m3u8 URL) directly to the video element through the `src` property.
  19. // This is using the built-in support of the plain video element, without using hls.js.
  20. // Note: it would be more normal to wait on the 'canplay' event below however on Safari (where you are most likely to find built-in HLS support) the video.src URL must be on the user-driven
  21. // white-list before a 'canplay' event will be emitted; the last video event that can be reliably listened-for when the URL is not on the white-list is 'loadedmetadata'.
  22. else if (video.canPlayType('application/vnd.apple.mpegurl')) {
  23. video.src = 'https://video-dev.github.io/streams/x36xhzz/x36xhzz.m3u8';
  24. video.addEventListener('loadedmetadata',function() {
  25. video.play();
  26. });
  27. };
  28. var socket;
  29. function start_connection(){
  30. var socket = new WebSocket('ws://192.168.0.115:8080/koko/shmoko/zuzu?ID=2323089034');
  31. socket.onopen = function() { alert("Connection opened...") };
  32. socket.onclose = function() {
  33. alert("Connection closed...");
  34. socket = null;
  35. };
  36. socket.onopen = function(event) {
  37. socket.send('Some message')
  38. };
  39. socket.onmessage = function(event) {
  40. var message = event.data;
  41. alert( 'Resived:' + message );
  42. };
  43. };
  44. function chucha(){
  45. //var mimeCodec = 'video/mp4; codecs="avc1.4D401F"';
  46. var mimeCodec = 'video/mp4; codecs="avc1.64001E"'
  47. if (MediaSource.isTypeSupported(mimeCodec)) {
  48. // Create Media Source
  49. var mediaSource = new MediaSource(); // mediaSource.readyState === 'closed'
  50. alert('Codec OK');
  51. } else {
  52. alert("Unsupported media format");
  53. }
  54. };
  55. </script>
  56. </head>
  57. <body>
  58. <input type="button" onclick="start_connection();" value="Connect">
  59. <input type="button" onclick="chucha();" value="Check Codec">
  60. <video id="video" controls ></video>
  61. </video>
  62. </body>
  63. </html>