muaz-khan / RecordRTC

RecordRTC is WebRTC JavaScript library for audio/video as well as screen activity recording. It supports Chrome, Firefox, Opera, Android, and Microsoft Edge. Platforms: Linux, Mac and Windows.
https://www.webrtc-experiment.com/RecordRTC/
MIT License
6.45k stars 1.75k forks source link

How to select video/audio source devices #829

Closed PowZone closed 1 year ago

PowZone commented 1 year ago

Browser: Chrome OS: Windows 10

Hello, I have several video and audio sources configured on my pc. Can I configure RecordRTC to record from the sources I choose?

Thanks

PowZone commented 1 year ago

Solved.

Get list of devices:

    navigator.mediaDevices.enumerateDevices().then(function(da){
        console.log(da);
    }).catch(function(err){
        console.log('navigator.MediaDevices.getUserMedia error: ', err.message, err.name);
    });    

Modified code of the default example:

    navigator.mediaDevices.getUserMedia({
        video: {
            deviceId: da[selectedCameraIndex].deviceId,
        },
        audio: {
            deviceId: "default",
        }
    }).then(async function(stream) {
....