Jump to content
  • 0

Do not ask for permission when switching between screen and camera+screen modes


dmitry027
 Share

Question

Hello, everyone.

In /LiveApp/conference.html sample there are three modes available: camera, screen and camera+screen.

What is seem strange and inconvenient to me is the fact that we see permission prompt when we switching between screen and camera+screen modes (and vice versa) because in real life we're probably do not want to select other screen source when switching between these modes.

So I wonder is there any possibility in WebRTCAdaptor to use previous stream and avoid prompting user for permission every time they switch between screen and camera+screen and back?

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

Hi, @mustafaboleken. Thank you for your answer.

I don't think I need to keep both streams because in case of camera user grants permission only once and then he can toggle camera (call getUserMedia) as many times as he wants without being prompted for permission.

On the other hand result of getDisplayMedia can not be persisted for reuse. As a result user is prompted for permission every time getDisplayMedia is called. What I'm trying to achieve is to avoid calling getDisplayMedia again when we already have screen stream currently available (when we switching from screen to camera+screen or back).

Link to comment
Share on other sites

  • 0
On 11/24/2022 at 2:38 PM, mustafaboleken said:

Hi @dmitry027

 

I'm not sure if it's possible. What do you think about that? @Selim

Sorry, for the intervention in the middle of thread, I would like to add my opinion that this is not possible.

Since it's a browser call, and no any browser will grant such permission without user consent (Privacy breach) and there is no any other way to achieve this.

@dmitry027 If you find its solution somewhere please let us know. We can try together.

  • Like 1
Link to comment
Share on other sites

  • 0
3 hours ago, rahul7827 said:

Sorry, for the intervention in the middle of thread, I would like to add my opinion that this is not possible.

Since it's a browser call, and no any browser will grant such permission without user consent (Privacy breach) and there is no any other way to achieve this.

@dmitry027 If you find its solution somewhere please let us know. We can try together.

Hello, @rahul7827, thank you for the answer.

I still think that it is possible 🙂. I do, because in screen or camera+screen mode we already have media stream captured from the screen, so we don't need to call getDisplayMedia again. We can just use existing stream for the new mode.

I will try to illustrate the flow with an example:

1. Let's assume that initial mode is 'camera'. We have one media stream here.

2. User switching from 'camera' to 'camera+screen' mode. At this point he is prompted by the browser to allow screen share. After that we have two media streams (camera and screen) merged into one on the client side before sending to the server.

3. User switch from 'camera+screen' to 'screen' mode. Here we could switch off camera stream and use existing screen stream to broadcast (instead of switching off both and then prompting user for screen access permission again). 

Link to comment
Share on other sites

  • 0

Hi @dmitry027

Yes that can be done, If you have both the streams but as @mustafaboleken already mentioned

It would have CPU cost on the client side also this is not a good practice.

If you have such use case, you have to customize the SDK code as well have to keep in mind that these customization should not impact any other dependent variables and functions.

  • Like 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...