android/src/main/java/com/oney/WebRTCModule/WebRTCModule.java
/**
     * Parses mandatory and optional "GUM" constraints described by a specific
     * <tt>ReadableMap</tt>.
     *
     * @param constraints A <tt>ReadableMap</tt> which represents a JavaScript
     * object specifying the constraints to be parsed into a
     * <tt>MediaConstraints</tt> instance.
     * @return A new <tt>MediaConstraints</tt> instance initialized with the
     * mandatory and optional constraint keys and values specified by
     * <tt>constraints</tt>.
     */
Parses mandatory and optional "GUM" constraints described by a specific
ReadableMap.

@param constraints A ReadableMap which represents a JavaScript
object specifying the constraints to be parsed into a
MediaConstraints instance.
@return A new MediaConstraints instance initialized with the
mandatory and optional constraint keys and values specified by
constraints.
Parses mandatory and optional " GUM " constraints described by a specific ReadableMap . @param constraints A ReadableMap which represents a JavaScript object specifying the constraints to be parsed into a MediaConstraints instance . @return A new MediaConstraints instance initialized with the mandatory and optional constraint keys and values specified by constraints .
MediaConstraints parseMediaConstraints(ReadableMap constraints) {
        MediaConstraints mediaConstraints = new MediaConstraints();
        if (constraints.hasKey("mandatory")
                && constraints.getType("mandatory") == ReadableType.Map) {
            parseConstraints(
                    constraints.getMap("mandatory"),
                    mediaConstraints.mandatory);
        } else {
            Log.d(TAG, "mandatory constraints are not a map");
        }
        if (constraints.hasKey("optional")
                && constraints.getType("optional") == ReadableType.Array) {
            ReadableArray optional = constraints.getArray("optional");
            for (int i = 0, size = optional.size(); i < size; i++) {
                if (optional.getType(i) == ReadableType.Map) {
                    parseConstraints(
                            optional.getMap(i),
                            mediaConstraints.optional);
                }
            }
        } else {
            Log.d(TAG, "optional constraints are not an array");
        }
        return mediaConstraints;
    }
MediaConstraints parseMediaConstraints ( ReadableMap constraints ) { MediaConstraints mediaConstraints = new MediaConstraints ( ) ; if ( constraints . hasKey ( "mandatory" ) && constraints . getType ( "mandatory" ) == ReadableType . Map ) { parseConstraints ( constraints . getMap ( "mandatory" ) , mediaConstraints . mandatory ) ; } else { Log . d ( TAG , "mandatory constraints are not a map" ) ; } if ( constraints . hasKey ( "optional" ) && constraints . getType ( "optional" ) == ReadableType . Array ) { ReadableArray optional = constraints . getArray ( "optional" ) ; for ( int i = 0 , size = optional . size ( ) ; i < size ; i ++ ) { if ( optional . getType ( i ) == ReadableType . Map ) { parseConstraints ( optional . getMap ( i ) , mediaConstraints . optional ) ; } } } else { Log . d ( TAG , "optional constraints are not an array" ) ; } return mediaConstraints ; }
Parses mandatory and optional "GUM" constraints described by a specific
 <tt>ReadableMap</tt>.
Parses mandatory and optional " GUM " constraints described by a specific <tt > ReadableMap< / tt > .