WebRTC firefox constraints
Edit the wiki link seems to be outdated, please refer to jib's answer down below.
It seems like Firefox has not yet implemented constraints.
Constraints have been implemented since Chrome 24 and Opera 18. These can be used to set values for video resolution for getUserMedia() and RTCPeerConnection addStream() calls.
and from: https://wiki.mozilla.org/Media/getUserMedia
Capture resolution [in Firefox] currently fixed to 640x480 for video;
It only supports
Minimal constraints supported: (Note: all of these booleans default to 'false')
video: true/false
audio: true/false
fake: true/false
picture: true/false
How to acquire multiple streams with different device constraints in Firefox?
Currently (Nightly is now 53) Firefox doesn't support multiple active audio input sources.
It's something we're thinking about, but it requires a couple of fairly major changes to our MediaStream plumbing. It's all related to drift - inputs (and outputs) running off different clocks.
We're considering taking an intermediate step towards this by interpreting a request for a new device as an intention to switch devices. That allows us to keep the first open while the prompt for the second is visible and then switch seamlessly. This is relatively low-hanging fruit for the issue in bug 1299324.
Firefox Frame Rate Max Constraint
Camera discovery
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.
Setting bandwidth limits
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.
Modifying SDP constraints for WebRTC in FireFox
Well, it seems that for now it is not supported, at least I am assuming so because there is yet to be a response to this bug. Guess I am stuck using Chrome for now.
What WebRTC constraints and options should i pass to get interoperability between Firefox and Google chrome
So, a few things:
- Whatever MDN page suggests RTPDataChannels is very outdated (let me know the URL). Both Firefox and Chrome support spec DataChannels now. Same for DTLSSRTPKeyAgreement I believe
- Make sure you call createDataChannel() before createOffer()
- Is it video-only, or video+audio? We fixed a bug with video-only streams recently if I recall not triggering onAddStream. That would explain 1 and [6] I think. See bug 1035067, which is landed in Nightly and Aurora (FF33); I've asked for uplift to Beta/32
- The "expects 4 fields" issue if I recall was bug in Firefox - what versions are you running? We did have a bug fixed in 30(?) where we had an unneeded space on the end which caused chrome to reject it - they patched to avoid it, and we fixed it.
Try it with FF Beta, and Nightly (http://nightly.mozilla.org/). And when you report things like this, please indicate what versions of browser you're using! :-)
WebRTC video constraints not working
There are numerous bugs that are being handled in Firefox for it not supporting programable video framerate and resolution changes.
- Allowing the framerate to be changed in the media constraints
- Support runtime change of video resolution
- Support plain numbers for the video resolution in the media constraints
You are supposedly able to set the constraints this way:
mediaConstraints = {
"audio": true,
"video": {
width: {
min: 320,
max: 320
},
height: {
min: 240,
max: 240
} }
};
But I have never been able to get video resolution constraints to work it to work in Firefox through media constraints. I have had limited success with changing the default resolution in about:config
in firefox.
These issues are known and I believe that numerous people are working on them to get them resolved.
Related Topics
Selectionstart/Selectionend on Input Type="Number" No Longer Allowed in Chrome
Rendering React Components with Promises Inside the Render Method
Uint8Array to String in JavaScript
Differencebetween Regexp's Exec() Function and String's Match() Function
Dynamic Template Urls in Angular 2
Why Does the Promise Constructor Need an Executor
What Is the "Hasclass" Function with Plain JavaScript
Passing a Function with Parameters as a Parameter
How to Control the Back Button Event in Jquery Mobile
Ruby Methods Within JavaScript Within Haml
Clear Text Selection with JavaScript
The Best Way to Synchronize Client-Side JavaScript Clock with Server Date