daily-co / react-native-daily-js

https://docs.daily.co/reference/rn-daily-js
BSD 2-Clause "Simplified" License
36 stars 13 forks source link

Bug: Update local subscription doesn't work #43

Closed hahtml closed 10 months ago

hahtml commented 1 year ago

Expected behavior

When I update the local participant with a custom config, the subscription should be changed.

Describe the bug (unexpected behavior)

When we implement screen share feature, we need to show screen share stream on mobile. Currently we have no way to retrieve the screen stream from the device directly. we have to subscribe to local participant with callObject.updateParticipants({ local: { setSubscribedTracks: { screenVideo: true } }}), but the track status of local participant is not changed.

Note that a warning message: update setSubscribedTracks can't be applied to participant; skipping local Is it an expected behavior to skip subscription updating if we try to update local participant? The subscription of Local participant is allowed to be updated corresponding to the docs https://docs.daily.co/reference/rn-daily-js/instance-methods/update-participant

Screenshots

Screenshot 2023-08-08 at 3 08 12 PM

System information

* Device: * OS, version: * Browser, version: # Additional context
filipi87 commented 1 year ago

Hi @hahtml, you should not need to subscribe to your local tracks, that is why you are receiving that warning message.

About retrieving your local stream, once your local screen share has started, you are going to receive a participant-updated event once the stream is available for your local participant. So, you should be able to retrieve your local stream like this:

callObject.on('participant-updated', (e) => {
  if(e?.participant?.local && e.participant.tracks?.screenVideo?.state === 'playable'){
    console.log('local-screen-share-started, stream => ', callObject.participants().local.tracks.screenVideo.persistentTrack)
  }
})

Let me know if that works.

hahtml commented 1 year ago

Hi @filipi87 , we do receive playable screen video track after screen share started, but the video stream shown by DailyMediaView is black. The same tile view works well with regular video streams at the same time. Note that the screen share stream is published successfully and we could see it in the meeting room.

You could see the state of video is playable.

Screenshot 2023-08-10 at 5 06 58 PM

The same view components are used in screen share and regular video stream, and you could see it works in the second view. I have tried both track and persistentTrack. Neither works in this case.

IMG_9400

Do we need to set up DailyMediaView for screen view specifically?

filipi87 commented 1 year ago

Hi @hahtml,

I believe you are trying that on iOS, right ?

I tested on Android, and that is why It was working in my case. In order to make it work, I haven't done anything special, just created the DailyMediaView with mirror=false and objectFit="contain".

But for iOS, there is a known limitation from webrtc. Which has being mentioned in both this issues from react-native-webrtc: - https://github.com/react-native-webrtc/react-native-webrtc/issues/1387https://github.com/react-native-webrtc/react-native-webrtc/issues/1409 ( This second issue is marked as closed, but looks like they have only tested on Android)

On iOS, in order to be able to use the screen sharing, we need to create a Broadcast Upload Extension. And the source from our video track is what we receive from this extension. So, I believe there is some limitation on iOS that is preventing it from showing the local stream.

filipi87 commented 10 months ago

Closing this issue since it is a known limitation of WebRTC that we have no immediate plans to add support for.