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.

Home Page:https://www.webrtc-experiment.com/RecordRTC/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to select video/audio source devices

PowZone opened this issue · comments

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

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) {
....