stream-example.html 1.1KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta name="viewport" content="width=320, initial-scale=1"/>
  5. <title>jsmpeg streaming</title>
  6. <style type="text/css">
  7. body {
  8. background: #333;
  9. text-align: center;
  10. margin-top: 10%;
  11. }
  12. </style>
  13. </head>
  14. <body>
  15. <canvas id="videoCanvas" width="640" height="480">
  16. <p>
  17. Please use a browser that supports the Canvas Element, like
  18. <a href="http://www.google.com/chrome">Chrome</a>,
  19. <a href="http://www.mozilla.com/firefox/">Firefox</a>,
  20. <a href="http://www.apple.com/safari/">Safari</a> or Internet Explorer 10
  21. </p>
  22. </canvas>
  23. <script type="text/javascript" src="jsmpg.js"></script>
  24. <script type="text/javascript">
  25. // Show loading notice
  26. var canvas = document.getElementById('videoCanvas');
  27. var ctx = canvas.getContext('2d');
  28. ctx.fillStyle = '#444';
  29. ctx.fillText('Loading...', canvas.width/2-30, canvas.height/3);
  30. // Setup the WebSocket connection and start the player
  31. var client = new WebSocket( 'ws://example.com:8084/' );
  32. var player = new jsmpeg(client, {canvas:canvas});
  33. </script>
  34. </body>
  35. </html>