summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webcodecs/encodedVideoChunk-serialization.crossAgentCluster.helper.html
blob: 424ce927f9a14acdb96d801cdf7fe6c7a7d5349a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<!DOCTYPE html>
<html>
<body>
<p id='location'></p>
<div id='log'></div>
<script>
  document.querySelector('#location').innerHTML = window.origin;
  let received = new Map();
  window.onmessage = (e) => {
    let msg = e.data + ' (from ' + e.origin + ')';
    document.querySelector('#log').innerHTML += '<p>' + msg + '<p>';
    if (e.data.hasOwnProperty('id')) {
      e.source.postMessage(
        received.get(e.data.id) ? 'RECEIVED' : 'NOT_RECEIVED', '*');
      return;
    }
    if (e.data.toString() == '[object EncodedVideoChunk]') {
      received.set(e.data.timestamp, e.data);
    }
  };
</script>
</body>
</html>