receiver.html 955 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <!DOCTYPE html>
  2. <!--
  3. Copyright 2020 The Chromium Authors. All rights reserved.
  4. Use of this source code is governed by a BSD-style license that can be
  5. found in the LICENSE file.
  6. -->
  7. <html>
  8. <head>
  9. <meta charset="utf-8">
  10. <style>
  11. html, body {
  12. height: 100%;
  13. }
  14. body {
  15. display: flex;
  16. margin: 0;
  17. }
  18. video {
  19. background-color: black;
  20. max-width: 100%;
  21. height: auto;
  22. }
  23. </style>
  24. </head>
  25. <body>
  26. <video src="data:cast_streaming_receiver">
  27. <script>
  28. // The Cast Streaming session must stop when the stream is no longer visible. crbug.com/1111886
  29. document.addEventListener('visibilitychange', function(e) {
  30. if (document.hidden) {
  31. window.close();
  32. }
  33. });
  34. var video = document.querySelector('video');
  35. video.addEventListener('ended', window.close);
  36. video.addEventListener('error', window.close);
  37. video.play().catch(window.close);
  38. </script>
  39. </body>
  40. </html>