[Webkit-unassigned] [Bug 211483] WebRTC replaceTrack adding latency

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu May 7 17:13:20 PDT 2020


https://bugs.webkit.org/show_bug.cgi?id=211483

--- Comment #3 from Marc <marc at launchinteractive.com.au> ---
Sure. I'm testing this on my iPhone XS.

1. Load https://webrtc.github.io/samples/src/content/peerconnection/pc1/
2. Click Start (Allow) and then Call
3. Wave at the camera to show that its almost in sync
4. paste this code into the console:

let cameraIds = [];

navigator.mediaDevices.enumerateDevices().then(function(deviceInfos)
{
        for (let i = 0; i !== deviceInfos.length; ++i)
        {
                const deviceInfo = deviceInfos[i];
                if (deviceInfo.kind === 'videoinput')
                {
                        cameraIds.push(deviceInfo.deviceId);
                }
        }
});
let idCount = 1;

function swapCamera()
{
        navigator.mediaDevices
          .getUserMedia({
            video: {
              deviceId: {
                exact: cameraIds[idCount]
              }
            }
          })
          .then(function(stream) {
                  console.log('gotstream');
                  localVideo.srcObject = stream;
            let videoTrack = stream.getVideoTracks()[0];
              var sender = pc1.getSenders().find(function(s) {
                return s.track.kind == videoTrack.kind;
              });
              sender.replaceTrack(videoTrack);
          })
          .catch(function(err) {
            console.error('Error happens:', err);
          });

          idCount++;
          if(idCount >= cameraIds.length)
          {
                  idCount = 0;
          }
 }

5. call swapCamera() function
6. call swapCamera() function again to return to first camera
7. wave at camera to see the delay.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20200508/4cb5537c/attachment.htm>


More information about the webkit-unassigned mailing list