Reputation: 1284
In Firefox, when calling getUserMedia(), I've added a constraint to limit the frame rate. However, any value below 30fps doesn't allow a webcam choice in the GUM permissions dialog.
For exmaple, I've cloned and changed the constraints example of github.com/webrtc/samples at https://mikeg0.github.io/samples/src/content/peerconnection/constraints/. I renamed the frameRate.min variable to frameRate.max. This works as expected in Chrome, but not in Firefox.
I found this bugzilla report, but it says frame rate constraints are implemented. Is this something Firefox has yet to sort out? Is it related to this bug?
Or am I using this constraint incorrectly?
Upvotes: 6
Views: 4349
Reputation: 42530
Browsers (and even OS'es) disagree about which camera modes to return from getUserMedia
.
Whereas Chrome rescales and crops to whatever you ask for, Firefox returns modes native to your specific camera(s) only. Both are within the spec.
Both approaches have advantages, but unfortunately they're mutually exclusive, since if you always get what you want then you've discovered nothing about the camera.
As to why you get no modes below 30 fps, it may be because your camera doesn't have any. For what it's worth, with Firefox on Windows 7, I get all sorts of modes from my Logitech C920, but when I limit frame rate, I tend to get back only quite high resolution modes (like 2592 x 1944 x 10fps), which may be a trait of my specific model.
On OSX there's also bug 1131861 which you found. OSX is tricky because of how little it reveals about cameras at the OS level. The 30 fps is an artificial limitation there at the moment.
It sounds from your comments that your real concern is reducing bandwidth requirements of a peer connection. The spec is still working on how to specify encoding parameters like bitrate, resolution and framerate directly, which currently looks something like this:
var encoding = { maxBitrate: 60000, maxFramerate: 5, scaleResolutionDownBy: 2 };
var sender = pc.addTrack(stream.getVideoTracks()[0], stream);
sender.setParameters({ encodings: [encoding] });
You can specify more than one encoding
for simulcast.
This functionality is available in Firefox 47 (Beta), where this fiddle should work.
Upvotes: 5