Bug 174810

Summary: videoWidth and videoHeight are 0 when using Mock Capture Devices and a muted video track
Product: WebKit Reporter: Adam <adam>
Component: MediaAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: eric.carlson, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: Mac   
OS: macOS 10.12.4   

Description Adam 2017-07-24 20:33:56 PDT
If you have a muted video track with real devices you still get the correct videoWidth and videoHeight on the video element. However if you are using the Mock Capture Devices then you get 0x0.

Here is some sample code to reproduce the problem: https://output.jsbin.com/kokeqob

navigator.mediaDevices.getUserMedia({
  audio: true,
  video: true
}).then(stream => {
  stream.getVideoTracks()[0].enabled = false;
  const vid = document.createElement('video');
  vid.srcObject = stream;
  document.body.appendChild(vid);
  checkVideoDimensions(vid);
  vid.play();
}).catch(err => {
  console.error(err);
});

function checkVideoDimensions(vid) {
  const showDimensions = () => {
    videoWidth.innerHTML = vid.videoWidth;
    videoHeight.innerHTML = vid.videoHeight;
  };
  
  vid.addEventListener('loadedmetadata', showDimensions);
  vid.addEventListener('timeupdate', showDimensions);
  setInterval(showDimensions, 2000);
}

If you visit that URL and allow access to your camera using real devices you will see that videoWidth and videoHeight are 640x480. However if you choose the Mock Capture Devices option then you get 0x0.
Comment 1 Radar WebKit Bug Importer 2017-07-27 13:47:42 PDT
<rdar://problem/33575504>