Re: [mediacapture-fromelement] The sequence canvas.transferControlToOffscreen() followed by canvas.captureStream() does not appear to be specified (#84)

Chromium implements `requestFrame()` on the `MediaStreamTrack`. Firefox still implements `requestFrame()` on `MediaStream`.

Nonetheless when `autoplay` is set on an HTML `<video>` element and the `MediaStream` from `canvas.captureStream()` is set as `srcObject` of the `<video>` and `requestFrame()` is executed the `<video>` `currentTime` does not increment.

```
  <canvas style="border:1px solid green"></canvas>
  <video controls autoplay></video>
  <script>
    const canvas = document.querySelector("canvas");
    const offscreen = canvas.transferControlToOffscreen();
    const stream = canvas.captureStream(0);
    const worker = new Worker("firefoxNightlyOffscreenCanvasNotVisibleIncorrectWidthAndHeightWorker.js");
    worker.onmessage = e => {
      const {
        width, height
      } = e.data;
      const stream = canvas.captureStream();
      document.querySelector("video").srcObject = stream;
      let n = 0;
      const requestFrame = _ => {
        if (canvas.width !== width && canvas.height !== height) {
          console.assert(canvas.width === width && canvas.height === height, [width, height, canvas.width, canvas.height]);
           requestAnimationFrame(requestFrame);
        } else {
          // document.querySelector("video").currentTime remains at 0
          console.log(canvas.width === width && canvas.height === height, [width, height, canvas.width, canvas.height], {n}, document.querySelector("video").currentTime);
          stream.getVideoTracks()[0].requestFrame();
          ++n;
          requestAnimationFrame(requestFrame);
        }
      } 
      requestAnimationFrame(requestFrame);
    }
    worker.postMessage({
      offscreen
    }, [offscreen]);
</script>
```

-- 
GitHub Notification of comment by guest271314
Please view or discuss this issue at https://github.com/w3c/mediacapture-fromelement/issues/84#issuecomment-574307512 using your GitHub account

Received on Tuesday, 14 January 2020 18:23:12 UTC