admin管理员组文章数量:1417070
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/webrtc/samples at /. 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?
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./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?
Share Improve this question asked Feb 19, 2016 at 22:40 Michael GorhamMichael Gorham 1,2842 gold badges17 silver badges25 bronze badges 4- Is this on OSX by any chance? – jib Commented Feb 19, 2016 at 22:49
- Sorry for leaving that out. Happening on Windows 10. – Michael Gorham Commented Feb 20, 2016 at 17:10
- Just tested on OSX and is indeed happening there too. And I just found this issue ... bugzilla.mozilla/show_bug.cgi?id=1131861 I'll leave it to the experts to sort it out. Personally, I'm more interested in bandwidth limiting than framerate constraints :) – Michael Gorham Commented Feb 22, 2016 at 22:20
- I am also having the same issue in Firefox with most cameras. Chrome works as expected. I found that one camera works as expected in Firefox, Logitech HD Webcam C920. In most cameras, I get the error "OverconstrainedError: Constraints could be not satisfied". Based on examples at Firefox (developer.mozilla/en-US/docs/Web/API/MediaDevices/…) I would expect this to work. It appears to be a Firefox device issue with some web cameras. I experience this issue with Firefox in both Windows and Apple. – Daryl Commented Sep 11, 2017 at 20:24
1 Answer
Reset to default 5Camera 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 ments 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.
本文标签: javascriptFirefox Frame Rate Max ConstraintStack Overflow
版权声明:本文标题:javascript - Firefox Frame Rate Max Constraint - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745257938a2650213.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论