Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including rtc-tweak-constraints with all npm packages installed. Try it out:

var rtcTweakConstraints = require("rtc-tweak-constraints")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

rtc-tweak-constraints v1.0.0

A series of functional helpers for applying limits to media capture constraints

rtc-constraints

A series of functional helpers for applying transforms to media capture constraints.

NPM

Example Usage

var tweak = require('rtc-tweak-constraints');
var getUserMedia = require('getusermedia');
var streamui = require('rtc-ui/stream');
var chain = require('whisk/chain');

// create a limiter function
var adjustDimensions = chain([ tweak.w(160), tweak.h(120) ]);

// generate constraints with limited frame capture rate
var constraints = adjustDimensions(({ audio: true, video: true }));
console.log(constraints);

// capture media
getUserMedia(constraints, function(err, stream) {
  if (err) {
    return console.error(err);
  }

  // render the local stream using the stream ui
  streamui.local(document.body)(stream);
});

Reference

tweak.maxwidth(value, => constraints) => constraints

Apply appropriate maxwidth constraints.

tweak.minwidth(value, => constraints) => constraints

Apply appropriate minwidth constraints.

tweak.width(value, => constraints) => constraints

Apply both minwidth and maxwidth constraints.

tweak.maxheight(value, => constraints) => constraints

Apply appropriate maxheight constraints.

tweak.minheight(value, => constraints) => constraints

Apply appropriate minheight constraints.

tweak.height(value, => constraints) => constraints

Apply both minheight and maxheight constraints.

tweak.maxfps(value, => constraints) => constraints

Apply appropriate max framerate constraints.

tweak.minfps(value, => constraints) => constraints

Apply appropriate min framerate constraints.

tweak.fps(value, => constraints) => constraints

Apply both min and max framerate constraints.

License(s)

Apache 2.0

Copyright 2014 Damon Oehlman damon.oehlman@nicta.com.au

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free