api/easyrtc.js
function(constraints, onSuccess, onError) {
    var constraintsToFF37_ = function(c) {
      if (typeof c !== 'object' || c.require) {
        return c;
      }
      var require = [];
      Object.keys(c).forEach(function(key) {
        if (key === 'require' || key === 'advanced' || key === 'mediaSource') {
          return;
        }
        var r = c[key] = (typeof c[key] === 'object') ?
            c[key] : {ideal: c[key]};
        if (r.min !== undefined ||
            r.max !== undefined || r.exact !== undefined) {
          require.push(key);
        }
        if (r.exact !== undefined) {
          if (typeof r.exact === 'number') {
            r. min = r.max = r.exact;
          } else {
            c[key] = r.exact;
          }
          delete r.exact;
        }
        if (r.ideal !== undefined) {
          c.advanced = c.advanced || [];
          var oc = {};
          if (typeof r.ideal === 'number') {
            oc[key] = {min: r.ideal, max: r.ideal};
          } else {
            oc[key] = r.ideal;
          }
          c.advanced.push(oc);
          delete r.ideal;
          if (!Object.keys(r).length) {
            delete c[key];
          }
        }
      });
      if (require.length) {
        c.require = require;
      }
      return c;
    };
    constraints = JSON.parse(JSON.stringify(constraints));
    if (browserDetails.version < 38) {
      logging('spec: ' + JSON.stringify(constraints));
      if (constraints.audio) {
        constraints.audio = constraintsToFF37_(constraints.audio);
      }
      if (constraints.video) {
        constraints.video = constraintsToFF37_(constraints.video);
      }
      logging('ff37: ' + JSON.stringify(constraints));
    }
    return navigator.mozGetUserMedia(constraints, onSuccess, function(e) {
      onError(shimError_(e));
    });
  }
function(constraints, onSuccess, onError) {
    var constraintsToFF37_ = function(c) {
      if (typeof c !== 'object' || c.require) {
        return c;
      }
      var require = [];
      Object.keys(c).forEach(function(key) {
        if (key === 'require' || key === 'advanced' || key === 'mediaSource') {
          return;
        }
        var r = c[key] = (typeof c[key] === 'object') ?
            c[key] : {ideal: c[key]};
        if (r.min !== undefined ||
            r.max !== undefined || r.exact !== undefined) {
          require.push(key);
        }
        if (r.exact !== undefined) {
          if (typeof r.exact === 'number') {
            r. min = r.max = r.exact;
          } else {
            c[key] = r.exact;
          }
          delete r.exact;
        }
        if (r.ideal !== undefined) {
          c.advanced = c.advanced || [];
          var oc = {};
          if (typeof r.ideal === 'number') {
            oc[key] = {min: r.ideal, max: r.ideal};
          } else {
            oc[key] = r.ideal;
          }
          c.advanced.push(oc);
          delete r.ideal;
          if (!Object.keys(r).length) {
            delete c[key];
          }
        }
      });
      if (require.length) {
        c.require = require;
      }
      return c;
    };
    constraints = JSON.parse(JSON.stringify(constraints));
    if (browserDetails.version < 38) {
      logging('spec: ' + JSON.stringify(constraints));
      if (constraints.audio) {
        constraints.audio = constraintsToFF37_(constraints.audio);
      }
      if (constraints.video) {
        constraints.video = constraintsToFF37_(constraints.video);
      }
      logging('ff37: ' + JSON.stringify(constraints));
    }
    return navigator.mozGetUserMedia(constraints, onSuccess, function(e) {
      onError(shimError_(e));
    });
  }
function ( constraints , onSuccess , onError ) { var constraintsToFF37_ = function ( c ) { if ( typeof c !== 'object' || c . require ) { return c ; } var require = [ ] ; Object . keys ( c ) . forEach ( function ( key ) { if ( key === 'require' || key === 'advanced' || key === 'mediaSource' ) { return ; } var r = c [ key ] = ( typeof c [ key ] === 'object' ) ? c [ key ] : { ideal : c [ key ] } ; if ( r . min !== undefined || r . max !== undefined || r . exact !== undefined ) { require . push ( key ) ; } if ( r . exact !== undefined ) { if ( typeof r . exact === 'number' ) { r . min = r . max = r . exact ; } else { c [ key ] = r . exact ; } delete r . exact ; } if ( r . ideal !== undefined ) { c . advanced = c . advanced || [ ] ; var oc = { } ; if ( typeof r . ideal === 'number' ) { oc [ key ] = { min : r . ideal , max : r . ideal } ; } else { oc [ key ] = r . ideal ; } c . advanced . push ( oc ) ; delete r . ideal ; if ( ! Object . keys ( r ) . length ) { delete c [ key ] ; } } } ) ; if ( require . length ) { c . require = require ; } return c ; } ; constraints = JSON . parse ( JSON . stringify ( constraints ) ) ; if ( browserDetails . version < 38 ) { logging ( 'spec: ' + JSON . stringify ( constraints ) ) ; if ( constraints . audio ) { constraints . audio = constraintsToFF37_ ( constraints . audio ) ; } if ( constraints . video ) { constraints . video = constraintsToFF37_ ( constraints . video ) ; } logging ( 'ff37: ' + JSON . stringify ( constraints ) ) ; } return navigator . mozGetUserMedia ( constraints , onSuccess , function ( e ) { onError ( shimError_ ( e ) ) ; } ) ; }
getUserMedia constraints shim.
getUserMedia constraints shim .