[Webkit-unassigned] [Bug 212733] [iOS] applyConstraints should take into account rotation when computing width and height for video tracks

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Aug 5 09:02:18 PDT 2021


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

--- Comment #1 from milen <milen.yordanov at gmail.com> ---
This issue causes applyConstraints() to be not usable at all in our case.
The case is:

1) Get HD video.
2) Show preview.
3) Later switch to SD video. 

Tested on iPhone SE with iOS 14.7.1 in portrait orientation.
In landscape orientation the case works fine.

The result is:
The HD video preview is good. (the preview is in portrait orientation)
The SD video preview is cropped. (the preview is in landscape orientation even the phone is in portrait)

This is the code to reproduce the issue:
-----
let constraintsHD = {
    width: {ideal: 1280},
    height: {ideal: 720},
};

let constraintsSD = {
    width: {ideal: 640},
    height: {ideal: 360},
};

navigator.mediaDevices.getUserMedia({video: constraintsHD, audio: false})
.then(stream => {

    setTimeout(() => {
        let videoTrack = stream.getVideoTracks()[0];
        console.log("SETTINGS HD: ", videoTrack.getSettings());
    }, 1000);

    setTimeout(() => {
        let videoTrack = stream.getVideoTracks()[0];
        videoTrack.applyConstraints(constraintsSD).then(() => {
            let settings = videoTrack.getSettings();
            console.log("SETTINGS SD: ", videoTrack.getSettings());
        })
    }, 3000);
});
-----

It logs:
Settings HD: height: 1280, width: 720
Settings SD: height: 360, width: 640

As a workaround we don't use applyConstraints() and always use SD video on iOS.
The same case works fine in Chrome/Android.

-- 
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/20210805/5fd60cfd/attachment-0001.htm>


More information about the webkit-unassigned mailing list