910e62b5创建于 1月15日历史提交
<!DOCTYPE html>
<!--
Copyright 2020 The Chromium Authors
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<html>
<head>
  <meta charset="utf-8">
  <style>
    body {
      background-color: black;
      /* The following do not apply to <video> as it is fixed position. */
      height: 100%;
      display: flex;
      margin: 0;
    }
    video {
      width: 100vw;
      height: 100vh;
      object-fit: contain;
      position: absolute;
      top: 0;
      left: 0;
    }
  </style>
</head>

<body>
  <video src="data:cast_streaming_receiver">

  <script>
    // The Cast Streaming session must stop when the stream is no longer
    // visible. See crbug.com/1111886.
    document.addEventListener('visibilitychange', function(e) {
      if (document.hidden) {
        window.close();
      }
    });

    var video = document.querySelector('video');
    video.addEventListener('ended', window.close);
    video.addEventListener('error', window.close);

    // Await video element being able to play before calling play, as this
    // script can execute when the video element exists but before its playable.
    video.addEventListener('canplay', () => {
      video.play().catch(window.close);
    });
  </script>
</body>
</html>