# React js sdk, need help about screensharing and audio device

**URL:** <https://wazo-platform.discourse.group/t/react-js-sdk-need-help-about-screensharing-and-audio-device/1443>\
**Category:** Development: API/Events\
**Created:** [February 6, 2024, 1:41pm UTC](https://wazo-platform.discourse.group/t/react-js-sdk-need-help-about-screensharing-and-audio-device/1443 "2024-02-06T13:41:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![julienfr](https://yyz2.discourse-cdn.com/free1/user_avatar/wazo-platform.discourse.group/julienfr/32/797_2.png) [@julienfr](https://wazo-platform.discourse.group/u/julienfr)\
**Post date:** [February 6, 2024, 1:41pm UTC](https://wazo-platform.discourse.group/t/react-js-sdk-need-help-about-screensharing-and-audio-device/1443/1 "2024-02-06T13:41:44Z")

</div>

Hi there,  
I need help to make screensharing and change ring output device to work on my react wazo phone client.  
to connect the phone, i use:  
await Wazo.Phone.connect({ audio: true, video: true })

when i try:  
const screenShareStream = await Wazo.Phone.startScreenSharing({audio: true, video: true})  
i get a mediaStream, but nothing ask me the famous getDisplayMedia to get the content i want to share  
and when i do:  
const stream = await navigator.mediaDevices.getDisplayMedia({ audio: true, video: true })  
i don’t know what to do with it

And about the ring device, i try:  
const ring = await Wazo.Phone.phone.changeRingDevice(e.target.value)  
e.target.value is the deviceId  
I can see it in Wazo.Phone.phone, but the ring sound still in the previous/default output audio device

thanks

---

<div class="post-metadata">

**Author:** ![julienfr](https://yyz2.discourse-cdn.com/free1/user_avatar/wazo-platform.discourse.group/julienfr/32/797_2.png) [@julienfr](https://wazo-platform.discourse.group/u/julienfr)\
**Post date:** [February 7, 2024, 10:29am UTC](https://wazo-platform.discourse.group/t/react-js-sdk-need-help-about-screensharing-and-audio-device/1443/2 "2024-02-07T10:29:27Z")

</div>

yup,

ScreenSharing is working now, using sessionDescriptionHandler.peerConnection to push the new videoTrack.

The documentation of the Wazo.Phone.startScreenSharing() doesn’t help at all.

I’ll look for audio device later.

cheers

---

<div class="post-metadata">

**Author:** ![julienfr](https://yyz2.discourse-cdn.com/free1/user_avatar/wazo-platform.discourse.group/julienfr/32/797_2.png) [@julienfr](https://wazo-platform.discourse.group/u/julienfr)\
**Post date:** [February 7, 2024, 1:45pm UTC](https://wazo-platform.discourse.group/t/react-js-sdk-need-help-about-screensharing-and-audio-device/1443/3 "2024-02-07T13:45:18Z")

</div>

Here is something weird,

i use some Select to choose the deviceId

```auto
const handleRingChange = (e) => {
    setSelectedRingOutput(e.target.value);
    Wazo.Phone.phone.changeRingDevice(e.target.value);
  };

  const handleAudioOutputChange = (e) => {
    setSelectedAudioOutput(e.target.value);
    Wazo.Phone.phone.changeAudioDevice(e.target.value);
  };

```

for the test, i change the audioDevice and ringDevice the same way,  
so:  
Wazo.Phone.phone.audioOutputDeviceId  
Wazo.Phone.phone.audioRingDeviceId  
have both the same deviceId

the output audio is working, i can change it during the call, just works perfectly !  
but the audioRingDevice stil in the default audio device despite the value of Wazo.Phone.phone.audioRingDeviceId

looking deeper, i see no Wazo.Phone.phone.client.audioRingDevideId  
but i see  
`Wazo.Phone.phone.client.audioOutputDeviceId`

 ![image](https://global.discourse-cdn.com/free1/uploads/wazo_platform/original/1X/752caefb3a1cc956f9ca4ffdd4c822c7a57bb736.png)

So how can my WebRtcClient can ring on speaker and have the conversation on headphones ?

cheers

edit:  
maybe got it

> **[HTMLMediaElement: setSinkId() method - Web APIs | MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/setSinkId)**
>
> The HTMLMediaElement.setSinkId() method of the Audio Output Devices API sets the ID of the audio device to use for output and returns a Promise.
