aullman / opentok-meet

Opentok app with screen sharing using the WebRTC screen sharing feature
MIT License
133 stars 129 forks source link

How to grab sessionId to use with swift app #187

Closed masudhossain closed 7 years ago

masudhossain commented 7 years ago

I'm using this repo to build my web part for the video chat, and i'm building an ios app at the same time.

i'm curious how to sync up the sessionId's so the ios user and the web user can both be in the same room at once.

ie: if user goes to example.com/123 , i would want the ios user to also somehow connect to the /123 sessionId.

aiham commented 7 years ago

Since this is an express app, you can send HTTP requests from the iOS app in the same way the web app does to retrieve the session ID for a particular room name and the corresponding token in JSON format. You can then use this session ID and token to configure the iOS SDK and join the same session as the web user.

aullman commented 7 years ago

You might also want to use the custom URL handler in your iOS app so that if you go to example.com/123 on your iOS device it will open up your app automatically. Right now the format is meet://home/{room} https://github.com/aullman/opentok-meet/blob/master/views/roomiOS.ejs#L21

Also, keep in mind that Safari on iOS 11 supports WebRTC so this app works without need to build a custom iOS app.

img_0171

masudhossain commented 7 years ago

@aiham this worked, thanks!!

@aullman i just noticed you guys updated it to work with ios11, and it works great with safari on mobile! Although i did notice that it doesn't work properly when a user puts meet.tokbox.com/something inside another app such as Facebook.

Try going messaging yourself meet.tokbox.com/something on Facebook messenger app, and than clicking on the link and you'll see what i'm referring to. Not sure if this is a restriction done by apps or the code itself.

aiham commented 7 years ago

@masudhossain This is probably because WebRTC will not work in an iOS app's WebView, it is only available in the official Safari app at the moment. This is a restriction by Apple. I'm not sure if or when this will change.