Skip to content

Demo: constraints ERROR #16

@floydback

Description

@floydback

Since last chrome update demo page is not working. On select Audio input there is message:

Could not get audio media device: TypeError: Failed to execute 'getUserMedia' on 'MediaDevices': Malformed constraint: Cannot use both optional/mandatory and specific or advanced constraints.

Some changes make working in chrome:

if (navigator.webkitGetUserMedia !== undefined) {
    constraint = {
        video: false,
        audio: {
            optional: [
                {sourceId:deviceId},
                {googAutoGainControl: false},
                {googAutoGainControl2: false},
                {echoCancellation: false},
                {googEchoCancellation: false},
                {googEchoCancellation2: false},
                {googDAEchoCancellation: false},
                {googNoiseSuppression: false},
                {googNoiseSuppression2: false},
                {googHighpassFilter: false},
                {googTypingNoiseDetection: false},
                {googAudioMirroring: false}
            ]
        }
    }
}
else if (navigator.mozGetUserMedia !== undefined) {
    constraint = {
        video: false,
        audio: {
            deviceId: deviceId ? { exact: deviceId } : void 0,
            echoCancellation: false,
            mozAutoGainControl: false
            //mozNoiseSuppression: false
        }
    }

}
else {
    constraint = {
        video: false,
        audio: {
            deviceId: deviceId ? {exact: deviceId} : void 0,
            echoCancellation: false
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions