According to version 2.18 release notes, Publisher.replaceTrack misbehaviour is now fixed. I have version 2.20 and I came across the issue of hearing my voice after calling replaceTrack.
Here is my code:
function changeMediaStream(audioSource, videoSource, kind) {
openvidu.getUserMedia({
audioSource: audioSource, //refering to deviceId of the microphone that is about to replace the
//previous one. videoSource will be false when audioSource has value
// 'kind' will be 'audio'
videoSource: videoSource, //refering to deviceId of the camera that is about to replace the
//previous one. audioSource will be false when videoSource has
//value
// 'kind' will be 'video'
resolution: window.initializedPublisherProperties.resolution, //resolution with which I've had
//initiallized publisher
frameRate: window.initializedPublisherProperties.frameRate //frameRate with which I've had
//initiallized publisher
}).then(mediaStream => {
let track;
if (kind === 'audio') {
track = mediaStream.getAudioTracks()[0];
}
if (kind === 'video') {
track = mediaStream.getVideoTracks()[0];
}
publisher.replaceTrack(track).then(() => {
console.log('track changed successfully')
}).catch(error => {
console.error(error)
})
}).catch(error => {
console.error(error)
})
}
Do I do something wrong?
Thank you in advance