New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 620665 link

Starred by 3 users

Issue metadata

Status: Verified
Owner:
Closed: Aug 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

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.
 
Cc: ranjitkan@chromium.org
Components: Blink>Media
Labels: M-53
Status: Untriaged (was: Unconfirmed)
Able to reproduce the issue on Canary build 53.0.2769.2 on MAC 10.11.5. M52 versions of chrome gives the error as attached in the screenshot. Firefox gives the desired result   " web camera supports 1280x720," as the test machine has this resolution. 

Untriaging it so that it gets addressed.

Screen Shot 2016-06-17 at 12.20.05 PM.png
134 KB View Download
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));
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.!
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.
Project Member

Comment 5 by sheriffbot@chromium.org, Jul 4 2016

Labels: -M-53 M-54 MovedFrom-53
Moving this nonessential bug to the next milestone.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Components: -Blink>Media Blink>Webrtc>GetUserMedia
Owner: hta@chromium.org
Status: Assigned (was: Untriaged)
[triage] hta@ PTAL.

Comment 8 by hta@chromium.org, Aug 11 2016

Status: Started (was: Assigned)

Comment 10 by hta@chromium.org, Aug 22 2016

Status: Fixed (was: Started)
Status: Verified (was: Fixed)
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));

Components: -Blink>Webrtc>GetUserMedia Blink>GetUserMedia

Sign in to add a comment