New format for getUserMedia constraints for video resolution is not working correctly
Reported by
ktsaregr...@atlassian.com,
Jun 16 2016
|
||||||||
Issue description
UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36
Steps to reproduce the problem:
Launch following code from console on any page:
navigator.mediaDevices.getUserMedia({
video: {
width: { exact: 1280 },
height: { exact: 720 }
}
})
.then(function(stream){
let video = document.createElement('video');
video.src = URL.createObjectURL(stream);
video.onloadedmetadata = function() {
console.log('width is', this.videoWidth);
console.log('height is', this.videoHeight);
};
document.body.appendChild(video);
})
.catch(e => console.log(e));
What is the expected behavior?
If my web camera supports 1280x720, I should get HD video and console should log 1280 and 720 respectively.
If my web camera does not support 1280x720, I should get "ConstraintNotSatisfied" error.
What went wrong?
I'm getting 640x480 resolution.
Did this work before? N/A
Chrome version: 53.0.2769.0 canary (64-bit) Channel: canary
OS Version: OS X 10.11.5
Flash Version: Shockwave Flash 21.0 r0
Tested with Facetime HD camera on MacBook 13" late 2011. Also tested with some Logitech webcam (it doesn't actually support HD, but no "ConstraintNotSatisfied" is thrown and I receive 640x480 stream).
This also seems to be reproducible in Chrome 51 stable with navigator.webkitGetUserMedia.
Changing "exact" to "ideal" still gives 640x480 resolution for me on Facetime HD camera.
If I use "min" constraint instead of "exact" or "ideal", I'm getting 1280x720 resolution:
navigator.mediaDevices.getUserMedia({
video: {
width: { min: 1280 },
height: { min: 720 }
}
})
.then(function(stream){
let video = document.createElement('video');
video.src = URL.createObjectURL(stream);
video.onloadedmetadata = function() {
console.log('width is', this.videoWidth);
console.log('height is', this.videoHeight);
};
document.body.appendChild(video);
})
.catch(e => console.log(e));
For "advanced" constraints "exact" syntax is also not working:
navigator.mediaDevices.getUserMedia({
video: {
advanced: [
{
width: { exact: 1920 },
height: { exact: 1080 },
},
{
width: { exact: 1280 },
height: { exact: 720 },
},
{
width: { exact: 960 },
height: { exact: 720 }
},
{
width: { exact: 640 },
height: { exact: 360 }
},
{
width: { exact: 640 },
height: { exact: 480 }
},
{
width: { exact: 320 },
height: { exact: 180 }
},
{
width: { exact: 320 },
height: { exact: 240 }
}
]
}
})
.then(function(stream){
let video = document.createElement('video');
video.src = URL.createObjectURL(stream);
video.onloadedmetadata = function() {
console.log('width is', this.videoWidth);
console.log('height is', this.videoHeight);
};
document.body.appendChild(video);
})
.catch(e => console.log(e));
It still resolves to 640x480 resolution, while changing "exact" to "min" makes it select the 1280x720.
,
Jun 17 2016
It's strange that you're getting error with navigator.mediaDevices.getUserMedia on Chrome Canary 53.
Can you please try old "webkitGetUserMedia" version?
navigator.webkitGetUserMedia({
video: {
width: { exact: 1280 },
height: { exact: 720 }
}
}, stream => {
let video = document.createElement('video');
video.src = URL.createObjectURL(stream);
video.onloadedmetadata = function() {
console.log('width is', this.videoWidth);
console.log('height is', this.videoHeight);
};
document.body.appendChild(video);
}, e => console.log(e));
,
Jun 17 2016
Hi As I said I am not getting error on M53, but was able to reproduce it, It was on M52 Builds where I observed this error. Screen shot is from M52 build 52.0.2705.0. Thanks.!
,
Jun 17 2016
Thanks, just to clarify, bug is not about "navigator.mediaDevices.getUserMedia is not a function". It's expected that M52 doesn't have this feature.
,
Jul 4 2016
Moving this nonessential bug to the next milestone. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Jul 18 2016
,
Aug 10 2016
[triage] hta@ PTAL.
,
Aug 11 2016
,
Aug 11 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/03114092446268d86e2f6986a5c69a4ef6c9b11e commit 03114092446268d86e2f6986a5c69a4ef6c9b11e Author: hta <hta@chromium.org> Date: Thu Aug 11 17:14:29 2016 Add "exact" constraint evaluation to video picker. This lets the code accept constraints like: video: { width: { exact: 1280 }} with the same meaning as video: { width: { min: 1280, max: 1280 }} BUG= 620665 Review-Url: https://codereview.chromium.org/2231863004 Cr-Commit-Position: refs/heads/master@{#411364} [modify] https://crrev.com/03114092446268d86e2f6986a5c69a4ef6c9b11e/content/renderer/media/media_stream_constraints_util.cc [modify] https://crrev.com/03114092446268d86e2f6986a5c69a4ef6c9b11e/content/renderer/media/media_stream_constraints_util_unittest.cc [modify] https://crrev.com/03114092446268d86e2f6986a5c69a4ef6c9b11e/content/renderer/media/media_stream_video_source.cc [modify] https://crrev.com/03114092446268d86e2f6986a5c69a4ef6c9b11e/content/renderer/media/media_stream_video_source_unittest.cc
,
Aug 22 2016
,
Aug 29 2016
Verified in M54 54.0.2840.3 in Mac 10.11.6
Tested with Facetime HD, Logitech Webcam C930e - both HD cameras
Launched the code (below) and verified that I see HD video and console log shows 1280 and 720 respectively.
navigator.mediaDevices.getUserMedia({
video: {
width: { exact: 1280 },
height: { exact: 720 }
}
})
.then(function(stream){
let video = document.createElement('video');
video.src = URL.createObjectURL(stream);
video.onloadedmetadata = function() {
console.log('width is', this.videoWidth);
console.log('height is', this.videoHeight);
};
document.body.appendChild(video);
})
.catch(e => console.log(e));
,
Sep 29 2016
|
||||||||
►
Sign in to add a comment |
||||||||
Comment 1 by ranjitkan@chromium.org
, Jun 17 2016Components: Blink>Media
Labels: M-53
Status: Untriaged (was: Unconfirmed)
134 KB
134 KB View Download