Question regarding audio streaming

Nir Familier

New Member
Hi,
I have a Video Web Streaming server ,
When i split the audio from the video, i see that
when user users headphones, than the audio from the PC is not streamed(only from the Microphone is streamed.)
How can i fix this?
 

Nir Familier

New Member
Hi,

This is a website, and the users user the web camera, and they don't have those options.
I call :
stream = session.createStream({
name: `${userId}@${stage}@${simulationTypeId}@${sessionId}-video`,
display: localVideo,
cacheLocalResources: false,
receiveVideo: true,
receiveAudio: true,
record: true,
transport: "TCP",
constraints: {
video: {
width: 320,
height: 240
},
audio: true
}
// stripCodecs: "H264"
});
 

Max

Administrator
Staff member
Please look at Media Device example source code. To allow user to choose the microphone, you should:
1. Iterate through the all audio input devices
code
Code:
    Flashphoner.getMediaDevices(null, true).then(function (list) {
        list.audio.forEach(function (device) {
            var audio = document.getElementById("audioInput");
            var deviceInList = false;
            for (var i = 0; i < audio.options.length; i++) {
                if (audio.options[i].value === device.id) {
                    deviceInList = true;
                    break;
                }
            }
            if (!deviceInList) {
                var option = document.createElement("option");
                option.text = device.label || device.id;
                option.value = device.id;
                audio.appendChild(option);
            }
        });
        ...
    }).catch(function (error) {
        $("#notifyFlash").text("Failed to get media devices");
    });
2. Add the chosen device Id to the publishing constraints
code
Code:
       constraints.audio = {
            deviceId: $('#audioInput').val()
        };
 
Top