function transformConstraints(constraints) {
      if (Object.keys(constraints).length === 0) {
        return constraints;
      }

      if ((constraints.mandatory || constraints.optional) && !CHROMIUM) {
        // convert to new format

        // Merge mandatory and optional objects, prioritizing mandatory
        var newConstraints = Object.assign({}, constraints.optional, constraints.mandatory);

        // fix casing
        if (newConstraints.OfferToReceiveVideo !== undefined) {
          newConstraints.offerToReceiveVideo = newConstraints.OfferToReceiveVideo;
          delete newConstraints['OfferToReceiveVideo'];
        }

        if (newConstraints.OfferToReceiveAudio !== undefined) {
          newConstraints.offerToReceiveAudio = newConstraints.OfferToReceiveAudio;
          delete newConstraints['OfferToReceiveAudio'];
        }

        return newConstraints;
      } else if (!constraints.mandatory && !constraints.optional && CHROMIUM) {
        // convert to old format

        // fix casing
        if (constraints.offerToReceiveVideo !== undefined) {
          constraints.OfferToReceiveVideo = constraints.offerToReceiveVideo;
          delete constraints['offerToReceiveVideo'];
        }

        if (constraints.offerToReceiveAudio !== undefined) {
          constraints.OfferToReceiveAudio = constraints.offerToReceiveAudio;
          delete constraints['offerToReceiveAudio'];
        }

        return {
          mandatory: constraints // NOTE: All constraints are upgraded to mandatory
        };
      }

      return constraints;
    }
/**
     * Transform constraints objects into the new format (unless Chromium)
     * TODO: This can be removed when Chromium supports the new format
     */
Transform constraints objects into the new format (unless Chromium)
TODO: This can be removed when Chromium supports the new format
Transform constraints objects into the new format ( unless Chromium ) TODO : This can be removed when Chromium supports the new format
function transformConstraints(constraints) {
      if (Object.keys(constraints).length === 0) {
        return constraints;
      }
      if ((constraints.mandatory || constraints.optional) && !CHROMIUM) {
        var newConstraints = Object.assign({}, constraints.optional, constraints.mandatory);
        if (newConstraints.OfferToReceiveVideo !== undefined) {
          newConstraints.offerToReceiveVideo = newConstraints.OfferToReceiveVideo;
          delete newConstraints['OfferToReceiveVideo'];
        }
        if (newConstraints.OfferToReceiveAudio !== undefined) {
          newConstraints.offerToReceiveAudio = newConstraints.OfferToReceiveAudio;
          delete newConstraints['OfferToReceiveAudio'];
        }
        return newConstraints;
      } else if (!constraints.mandatory && !constraints.optional && CHROMIUM) {
        if (constraints.offerToReceiveVideo !== undefined) {
          constraints.OfferToReceiveVideo = constraints.offerToReceiveVideo;
          delete constraints['offerToReceiveVideo'];
        }
        if (constraints.offerToReceiveAudio !== undefined) {
          constraints.OfferToReceiveAudio = constraints.offerToReceiveAudio;
          delete constraints['offerToReceiveAudio'];
        }
        return {
          mandatory: constraints 
        };
      }
      return constraints;
    }
function transformConstraints ( constraints ) { if ( Object . keys ( constraints ) . length === 0 ) { return constraints ; } if ( ( constraints . mandatory || constraints . optional ) && ! CHROMIUM ) { var newConstraints = Object . assign ( { } , constraints . optional , constraints . mandatory ) ; if ( newConstraints . OfferToReceiveVideo !== undefined ) { newConstraints . offerToReceiveVideo = newConstraints . OfferToReceiveVideo ; delete newConstraints [ 'OfferToReceiveVideo' ] ; } if ( newConstraints . OfferToReceiveAudio !== undefined ) { newConstraints . offerToReceiveAudio = newConstraints . OfferToReceiveAudio ; delete newConstraints [ 'OfferToReceiveAudio' ] ; } return newConstraints ; } else if ( ! constraints . mandatory && ! constraints . optional && CHROMIUM ) { if ( constraints . offerToReceiveVideo !== undefined ) { constraints . OfferToReceiveVideo = constraints . offerToReceiveVideo ; delete constraints [ 'offerToReceiveVideo' ] ; } if ( constraints . offerToReceiveAudio !== undefined ) { constraints . OfferToReceiveAudio = constraints . offerToReceiveAudio ; delete constraints [ 'offerToReceiveAudio' ] ; } return { mandatory : constraints } ; } return constraints ; }
Transform constraints objects into the new format (unless Chromium)
 TODO: This can be removed when Chromium supports the new format
Transform constraints objects into the new format ( unless Chromium ) TODO : This can be removed when Chromium supports the new format
// convert to new format // Merge mandatory and optional objects, prioritizing mandatory // fix casing // convert to old format // fix casing // NOTE: All constraints are upgraded to mandatory