proposals icon indicating copy to clipboard operation
proposals copied to clipboard

WebRTC

Open Ionitron opened this issue 5 years ago • 59 comments

Plugin Request

Name: WebRTC Package: @capacitor-community/webrtc

Platform(s)

iOS

Existing Solutions

Description

Ability to access MediaDevices.getUserMedia() natively for iOS to work with WebRTC.

Ionitron avatar Jun 17 '20 20:06 Ionitron

Original request: https://github.com/ionic-team/capacitor/issues/2944

Ionitron avatar Jun 17 '20 20:06 Ionitron

This would be nice!

danielehrhardt avatar Jun 28 '20 23:06 danielehrhardt

👍

phairow avatar Jul 02 '20 01:07 phairow

@phairow Upvote the original post so people can sort by it.

imhoffd avatar Jul 02 '20 05:07 imhoffd

Sure thing

phairow avatar Jul 02 '20 05:07 phairow

it would be awesome to have this pugin

bizready avatar Jul 05 '20 20:07 bizready

As far as I can tell, without this there is no way to use getUserMedia with capacitor on iOS, correct? This would be great to have!

RobbieTheWagner avatar Jul 05 '20 23:07 RobbieTheWagner

It is not just getUserMedia(). I am also getting an error with navigator.mediaDevices.addEventListener

bizready avatar Jul 06 '20 17:07 bizready

Yeah navigator.mediaDevices does not exist, so all of its methods are not usable currently.

RobbieTheWagner avatar Jul 06 '20 19:07 RobbieTheWagner

Interesting. The same code works fine in a browser environment or maybe it is not called in a browser environment. When deploying the code mobile, I get the error TypeError: undefined is not an object (evaluating 'navigator.mediaDevices.addEventListener'). Could you please point me to the link regarding navigator.mediaDevices that it does not exist? The code is part of the AWS Chime library so that I can report?

bizready avatar Jul 06 '20 20:07 bizready

@bizready it's a limitation of iOS. This issue here is the only possible fix. It has to be supported in Capacitor since iOS does not have it by default. There is a Cordova plugin, but it doesn't work with Capacitor. https://github.com/cordova-rtc/cordova-plugin-iosrtc

RobbieTheWagner avatar Jul 07 '20 12:07 RobbieTheWagner

Thanks @rwwagner90. I am experimenting with using https://github.com/cordova-rtc/cordova-plugin-iosrtc and it is very promising!

bizready avatar Jul 07 '20 12:07 bizready

@bizready as I mentioned, that Cordova plugin does not work with Capacitor.

RobbieTheWagner avatar Jul 07 '20 13:07 RobbieTheWagner

@rwwagner90 - I am using Quasar framework (one code base for web, mobile, and desktop). I can easily build code for Cordova or Capacitor. That way, I am in a good situation!

bizready avatar Jul 07 '20 15:07 bizready

@bizready sure, but then you are not using capacitor and this feature request is for capacitor. Those of us using capacitor are still stuck.

RobbieTheWagner avatar Jul 07 '20 15:07 RobbieTheWagner

For the time being (POC), I am ok in using Cordova. I want to use Capacitor. I do know that Capacitor can use Cordova plugins, that does not mean that isoRTC can be readily used in Capacitor. I am thinking that with some custom code, may be isoRTC can be used in Capacitor until we have Capacitor specific plugin?

bizready avatar Jul 07 '20 17:07 bizready

There is actually a bug filed in the webkit bugtracker: https://bugs.webkit.org/show_bug.cgi?id=208667

If you want to push Apple to fix that issue you can follow the instructions in the comments to show Apple that you are affected by this missing feature.

pszalanski avatar Jul 08 '20 06:07 pszalanski

I am thinking that with some custom code, may be isoRTC can be used in Capacitor until we have Capacitor specific plugin?

I saw a comment somewhere from the Capacitor team saying it won't work. I forget where I saw it.

RobbieTheWagner avatar Jul 09 '20 02:07 RobbieTheWagner

I have it(iosRTC) working with capacitor. Only odd issue is having to manage the binary within node_modules folder so it gets picked up on sync.

phairow avatar Jul 09 '20 04:07 phairow

@phairow how did you get it working?

RobbieTheWagner avatar Jul 10 '20 02:07 RobbieTheWagner

https://github.com/phairow/pubnubchatrcionic You can see my repo. You will see most of the settings I had to do documented in custom/publish.md. The final step was to disable bitcode for the app.

phairow avatar Jul 10 '20 03:07 phairow

This plugin would be nice!

gabsgasps avatar Aug 17 '20 19:08 gabsgasps

In the era of Zoom and telemedicine the WebRTC plugin is really necessary.

CloudROMB avatar Oct 14 '20 09:10 CloudROMB

navigator.mediaDevices.getUserMedia is implemented in iOS 14.3 beta according to this: https://webkit.org/blog/11353/mediarecorder-api/

imhoffd avatar Nov 23 '20 21:11 imhoffd

Hi, Is there a way to get a video stream (MediaStream) from Capacitor Camera.getPhoto( ) ?

rudyhadoux avatar Dec 17 '20 14:12 rudyhadoux

@dwieeb From my current tests it seems that navigator.mediaDevices.getUserMedia is indeed implemented in iOS 14.3. and my app correctly asks for the Camera permissions. But getUserMedia still fails with NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.

According to https://bugs.webkit.org/show_bug.cgi?id=208667 the reason is that capacitor uses the custom URL scheme capacitor://, I tried to change it do https://localhost:3000 via capacitor.config.json but while I was able to change the host to localhost:3000 the scheme capacitor:// does not seem be changeable on iOS.

7freaks-otte avatar Jan 03 '21 10:01 7freaks-otte

@7freaks-otte Looks like that's being addressed: https://github.com/WebKit/WebKit/commit/ff60f0a9b3a455b56adb95dbab14d404cb024152

imhoffd avatar Jan 08 '21 16:01 imhoffd

Hello,

I'm using ionic 5 with capacitor and angular9. and i have the same problem as @7freaks-otte. When i build the app on ios, I reveice an "notallowederror" at the line navigation.getUsermedia. If i understand well, it doesn't work natively and any plugin works with capacitor.

So today there is no way today to get the stream with capacitor ?

iometrine avatar Feb 15 '21 09:02 iometrine

Hello,

I'm using ionic 5 with capacitor and angular9. and i have the same problem as @7freaks-otte. When i build the app on ios, I reveice an "notallowederror" at the line navigation.getUsermedia. If i understand well, it doesn't work natively and any plugin works with capacitor.

So today there is no way today to get the stream with capacitor ?

https://github.com/cordova-rtc/cordova-plugin-iosrtc

danielehrhardt avatar Feb 15 '21 15:02 danielehrhardt

Doest https://github.com/cordova-rtc/cordova-plugin-iosrtc work with capacitor ?

iometrine avatar Feb 15 '21 15:02 iometrine