Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. <html>
  2. <head>
  3. <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
  4. </head>
  5. <body style="margin:0px;padding:0px;overflow:hidden">
  6. <script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
  7. <!-- Or if you want a more recent canary version -->
  8. <!-- <script src="https://cdn.jsdelivr.net/npm/hls.js@canary"></script> -->
  9. <video id="video"></video>
  10. <script>
  11. var video = document.getElementById('video');
  12. if(Hls.isSupported()) {
  13. var hls = new Hls();
  14. hls.loadSource('http://192.168.0.102:4003/play/a01d/index.m3u8');
  15. hls.attachMedia(video);
  16. hls.on(Hls.Events.MANIFEST_PARSED,function() {
  17. video.play();
  18. });
  19. }
  20. // hls.js is not supported on platforms that do not have Media Source Extensions (MSE) enabled.
  21. // 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 throught the `src` property.
  22. // This is using the built-in support of the plain video element, without using hls.js.
  23. // 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
  24. // 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'.
  25. else if (video.canPlayType('application/vnd.apple.mpegurl')) {
  26. video.src = 'http://192.168.0.102:4003/play/a01d/index.m3u8';
  27. video.addEventListener('loadedmetadata',function() {
  28. video.play();
  29. });
  30. }
  31. </script>
  32. </body>
  33. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement