Hi,
I am trying to record user screen with system and microphone audio but the record only has microphone audio.
I read the topic below as reference and try to implement the answers, but the record only has microphone audio:
Before , in initScreenPublisher method, when only record screen and micriphone audio (open vidu angular default code) :
private initScreenPublisher(): Publisher {
const videoSource = ScreenType.SCREEN;
const audioSource = this.hasAudioDevices ? undefined : null;
const willThereBeWebcam = this.localUsersService.isWebCamEnabled() && this.localUsersService.hasWebcamVideoActive();
const hasAudio = willThereBeWebcam ? false : this.hasAudioDevices && this.isAudioActive;
const properties = this.openViduWebRTCService.createPublisherProperties(videoSource, audioSource, true, hasAudio, false);
try {
return this.openViduWebRTCService.initPublisher(undefined, properties);
} catch (error) {
this.log.e(error);
this.utilsSrv.handlerScreenShareError(error);
}
}
Now i am trying to record user screen, microphone and audio system togheter:
private async initScreenPublisher(): Promise<Publisher> {
const gdmOptions = {
video: {
cursor: "always",
mediaSource: "screen"
},
audio: {
echoCancellation: true,
noiseSuppression: true,
sampleRate: 44100
}
}
const mediaDevices = navigator.mediaDevices as any;
const stream = await mediaDevices.getDisplayMedia(gdmOptions);
const properties = this.openViduWebRTCService.createPublisherProperties(stream.getVideoTracks()[0], stream.getAudioTracks()[0], true, true, false);
try {
return this.openViduWebRTCService.initPublisher(undefined, properties)
} catch (error) {
this.log.e(error);
this.utilsSrv.handlerScreenShareError(error);
}
}