Share Computer Sound

Hi everyone,

I’d like to implement the following:

A publisher publishing its webcam + audio, but in the meanwhile, it would be able to share with the viewers the computer sound as well.

So music can be played on the streamers computer which is streamed in perfect quality to the viewer, but the publisher can speak as well if needed.

Thanks for your help in advance,

I think you can do it by screen share with audio on but default its off due to echo problems
but you can it on .
But take care off echo
Thanks

1 Like

Hi @vipin_mishra,

Thanks for your answer. What do echo problems mean?
What I only can see in the call app is initScreenPublisher, where we give a screen type videoSource, but all the other happens under the hood.

When you published and subscribe two audio from same computer then it can echo…
Please check

Hi @vipin_mishra

Thanks one more time!

Could you please share how I can get the computer audio MediaStreamTrack?

As I see I should modify initScreenPublisher method in the video-room component (Angular Openvidu-Call), to set audioSource as well, but I cannot find out the method which results computer audio.

const properties = this.oVSessionService.createProperties(videoSource, undefined, true, hasAudio, false);

undefined should be changed I think so…

Thanks

@Balint_Dorner Did you ever get this resolved? We’re trying to do something like this, and wondered if you found a solution

Yes we could resolve it (bit hecky)
Needed to modify the initscreenpublisher method in video-room.component.ts.

const mediaDevices = navigator.mediaDevices as any; (any needed due to TS linter)

const stream = await mediaDevices.getDisplayMedia({video: true, audio: true});

const properties = this.oVSessionService.createProperties(stream.getVideoTracks()[0], stream.getAudioTracks()[0], false, true, false);

try {
return this.oVSessionService.initScreenPublisher(undefined, properties);
}

There are two parallel streams one for video+mic and the other is for system sound.

@netamity When you share the screen the webrtc screen sharing popup will come with share audio possibility, you have to tick it.
Screen won’t be shared since properties variable third parameter is false.

Publisher use a headset so they can hear the system sound as well and no echo.

Hope it helps, let me know if any fuirther clarification si needed

Hi,
Thank you. Glad you got it working. I’m unable to track down the video-room.component.ts files you speak of. Is that part of the openvidu server or the application (if they are different). I’ve extracted the openvidu server from github and also taken a look at my local files and can’t find video-room.component.ts.
Thanks in advance for your help.

When I look at script references in my console, I see a /OpenVidu/ folder with .ts file references which I can view in the console, but they are not actually in the filesystem when I look there. They must be dynamically loaded?

Any help you can provide is appreciated.

Andy

Hi @netamity

I have integrated openvidu-call-front into my app, you can find the source code here: https://github.com/OpenVidu/openvidu-call/tree/master/openvidu-call-front