Skip to content

Commit 807678b

Browse files
author
Chad Hart
committed
updated readme, clean up
1 parent 2693759 commit 807678b

File tree

2 files changed

+12
-24
lines changed

2 files changed

+12
-24
lines changed

README.md

+9-11
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,20 @@ Finds WebRTC Camera resolutions.
55

66
Simple demo to show how one can automatically identify camera resolutions for use with WebRTC.
77
Quick scan checks only common video resolutions.
8-
Full scan checks all 4:3 and 16:9 resolutions between a range.
8+
Full scan checks all 1:1, 4:3 and 16:9 resolutions between an entered range.
99

10-
### Updated August 2014
10+
### Updated February 2016
1111

1212
What's new:
13-
* Using jQuery
14-
* Redirect to https
15-
* Device enumeration and selection if your browser supports it
16-
* Optional predefined set of common resolutions for a "quick" scan
17-
* More complete scanning of every 16:9 and 4:3 resolution within a user-defined range
18-
* Used the official adapter.js from here to normalize browser differences & help with identification
19-
* Clicking on a row after the test is done reloads that resolution
20-
* Dump results to JSON or CSV
13+
* support of the latest WebRTC getUserMedia and device enumeration specs
14+
* link to [adapter-latest.js](https://webrtc.github.io/adapter/adapter-latest.js)
15+
* added 1:1 aspect ratio scan to the full scanner
16+
* added bootstrap
17+
* added some links to more easily jump around the table
18+
* made sure it works with Chrome, Firefox, and Edge
2119

2220
Try it at https://webrtchacks.github.io/WebRTC-Camera-Resolution/
2321

24-
Read more at http://webrtchacks.com/update-camera-constraints
22+
Read more at https://webrtchacks.com/getusermedia-resolutions-3/
2523

2624
Brought to you by [webrtcHacks.com](http://webrtchacks.com)

js/resolutionScan.js

+3-13
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ $(document).ready(function(){
5555

5656
//check if the user is using http vs. https & redirect to https if needed
5757
if (document.location.protocol != "https:"){
58-
alert("This doesn't work well on http. Redirecting to https");
58+
$(document).html("This doesn't work well on http. Redirecting to https");
59+
console.log("redirecting to https");
5960
document.location.href = "https:" + document.location.href.substring(document.location.protocol.length);
6061
}
6162

@@ -142,26 +143,15 @@ function gum(candidate, device) {
142143
stream.getTracks().forEach(function (track) {
143144
track.stop();
144145
});
145-
//try this for FF
146-
if (video.mozSrcObject)
147-
video.mozSrcObject.stop();
148146
}
149147

150148
//create constraints object
151149
var constraints = {
152150
audio: false,
153151
video: {
154-
/*mandatory: {
155-
sourceId: device.id,
156-
minWidth: {candidate.width,
157-
minHeight: candidate.height,
158-
maxWidth: candidate.width,
159-
maxHeight: candidate.height*/
160152
deviceId: device.id ? {exact: device.id} : undefined,
161153
width: {exact: candidate.width}, //new syntax
162154
height: {exact: candidate.height} //new syntax
163-
164-
// }
165155
}
166156
};
167157

@@ -187,7 +177,6 @@ function gum(candidate, device) {
187177

188178
window.stream = mediaStream; // make globally available
189179
video.srcObject = mediaStream;
190-
//video.play();
191180

192181
}
193182
}
@@ -400,6 +389,7 @@ function createAllResolutions(minHeight, maxHeight){
400389
resolutions.push(res);
401390

402391
//square
392+
//noinspection JSSuspiciousNameCombination
403393
res = {
404394
"label": y + "x" + y,
405395
"width" : y,

0 commit comments

Comments
 (0)