twilio / twilio-video-ios

Programmable Video SDK by Twilio
http://twilio.com/video
Other
65 stars 22 forks source link

Screen-sharing when already in a room #46

Closed claudiul closed 4 years ago

claudiul commented 5 years ago

Description

Hello, I have an app that uses twilio programable video. The user can connect to a room and share video and audio from the iOS devices camera/mic. We have recently added ReplayKit screen sharing via use of a broadcast extension (so that the user can also share the screen while outside of the app). When the call starts the call token is shared to the extension via shared user defaults.

Steps to Reproduce

  1. Connect to room
  2. Start video connection
  3. Start screensharing
  4. End screensharing

Expected Behavior

When screen sharing begins the video from the camera is stoped and only the screen is broadcast.When screen sharing is over the user can continue to share video/audio from the device camera/mic.

Actual Behavior

When screen sharing begins the user is kicked from the existing connection and reconnected to share the screen. When screen sharing is over we are required to send a message to the main app from the extension in order to force a reconnection to the room. Would there be a way to screen share without losing connection to the room?

Reproduction rate

100%

Versions

All relevant version information for the issue.

Xcode

10.2.1

iOS Version

12.2

iOS Device

All devices

paynerc commented 5 years ago

@claudiul,

It sounds like you are either using the same Access Token or using two separate Access Tokens with the same identity for connecting to the room from your application and in your ReplayKit extension. The server enforces a unique participant identity and will close a current connection when a second connection is created with the same identity.

To maintain both connections to the room, you will want to create a separate identity and Access Token for the ReplayKit extension to use.

Let me know if this helps!

Thanks!

Ryan

paynerc commented 5 years ago

@claudiul,

One other thing... When your app is in the background, you will still be able to share the microphone audio, however the camera is paused when outside of the application which is a limitation imposed by the OS. Just wanted to clarify that.

Thanks!

Ryan

claudiul commented 5 years ago

So if my user is loged in and in a video call and needs to start a screensharing session then basically I need to log in again( ? even if he's already logged in) and get a new access token for the extension?

paynerc commented 5 years ago

@claudiul,

So if my user is loged in and in a video call and needs to start a screensharing session then basically I need to log in again( ? even if he's already logged in) and get a new access token for the extension?

I guess that depends on how your token vending is tied to your user authentication/logging in. The important thing here is that each token will need a unique identity. So it wouldn't just be a case of logging in a second time to get a new token with the same identity, you would need to vend a token with a different identity. For instance, if the user logs in and has an identity of ryan@example.com, that would be fine for joining the room and sharing audio and video. Then for the ReplayKit extension, maybe you request another token for ryan-screenshare@example.com or the like. This way, when the extension connects to the room, the other participant does not get kicked out.

Ryan

paynerc commented 4 years ago

@claudiul,

It's been awhile since we last spoke. Have you arrived at a solution as suggested above? I am going to close this issue, but please feel free to reopen it if you still have questions.

Thank you,

Ryan

claudiul commented 4 years ago

Solved as you recommended, when entering a room I request a new token that is only used if the user shares his screen.