opentok / cordova-plugin-opentok

Cordova Plugin for OpenTok - add webrtc video to your iOS or Android App
MIT License
30 stars 80 forks source link

Include iOS build frameworks instead of using cordova hook #181

Open kazuyaseki opened 4 years ago

kazuyaseki commented 4 years ago

Feature Request

Description

I'm currently using Capacitor + ionic + React and would like to use cordova-plugin-opentok to run opentok in my application.

since @ionic/react does not let you use cordova plugin, I have to follow this Capacitor instruction. https://capacitor.ionicframework.com/docs/cordova/using-cordova-plugins/

but when I run npx cap sync, it throws an error

βœ– update ios: ENOENT: no such file or directory, stat '/myproject/node_modules/cordova-plugin-opentok/src/ios/OpenTok.framework'

I found that this is due to that this plugin is using cordova hook and capacitor does not support it. https://github.com/ionic-team/capacitor/issues/1997#issuecomment-536540434

Proposal Include iOS build frameworks instead of using cordova hook

Links / references https://capacitor.ionicframework.com/docs/cordova/using-cordova-plugins/ https://github.com/ionic-team/capacitor/issues/1997#issuecomment-536540434

vitonimal commented 4 years ago

I am having the same issue. I am unable to use OpenTok using capacitor. I am working on a workaround since I have a POC to hand back soon:

However, I am now getting this error: [error] Error running update: Analyzing dependencies Downloading dependencies Installing AppCenter (2.5.3) Installing Capacitor (2.0.1) Installing CapacitorCordova (2.0.1) Installing CordovaPlugins (2.0.0) Installing CordovaPluginsResources (0.0.105) Installing CordovaPluginsStatic (2.0.0) Installing OpenTok (2.16.6) Installing SVProgressHUD (2.2.5) [!] The 'Pods-App' target has frameworks with conflicting names: opentok.framework.

I also saw a comment on your reference where the person suggests to prepare the app with cordova and then copy the .framework afterwards, but I think it will do the same issue. I am trying this now. I will let you know if I can find anything. However, this update is crucial for opentok if they want support on capacitor.

UPDATE: Yeah, I am getting the exact same error trying to build the app using cordova

KyDenZ commented 4 years ago

On my side it works well, by copying the framework in the ios folder

enricop89 commented 4 years ago

Hi folks, do you mind testing https://github.com/opentok/cordova-plugin-opentok/pull/186?

vitonimal commented 4 years ago

Hi folks, do you mind testing #186?

I will test it today! and update this post when I get a result. Thank you!

KyDenZ commented 4 years ago

@enricop89 I tested, it works !

Thank you !

ramseyfeng commented 3 years ago

@KyDenZ Can I ask how you successfully play the opentok with capacitor?

KyDenZ commented 3 years ago

@ramseyfeng Apply the changes of #186 in custom repo or change url in package.json :

"cordova-plugin-opentok": "git+https://github.com/enricop89/cordova-plugin-opentok.git#capacitor-support"
ramseyfeng commented 3 years ago

@KyDenZ Many thanks! I'll try it later. πŸ‘

ramseyfeng commented 3 years ago

@KyDenZ I have tried your solution, it works fine on android devices, and it has some issue on iPhone device, it throws error when open the app video chat function, It can accept the media, and it seems cannot open the camera on ios device.

[error] - %cOpenTok:Publisher:error %conStreamAvailableError OT_NOT_SUPPORTED: A constraint specified is not supported by the browser. (getUserMedia error: NotSupportedError)%c +0ms color: #CC3300 color: inherit color: #CC3300

Do you have any experience with it? Or did you make it work on ios device?

KyDenZ commented 3 years ago

@ramseyfeng My app works with Android & IOS.

Before starting the session, I check if the Camera and Microphone are allowed with cordova diagnostic plugin.

ramseyfeng commented 3 years ago

Hi @KyDenZ could you share more light on this?

Are you using this plugin? https://github.com/dpa99c/cordova-diagnostic-plugin#iscamerapresent

what if the camera and microphone are not allowed? how can we turn on both of them?

BTW, I'm using the capacitor, and I have only installed only 1 Cordova plugin you mentioned: "cordova-plugin-opentok": "git+https://github.com/enricop89/cordova-plugin-opentok.git#capacitor-support"

Do I need to add some other Cordova plugins to support it? I really have no experience with Cordova...

A strange thing is that after installing the app on IOS, I don't see a Camera switch for this app... I have added the info.plist with NSCmeraUsageDescription.

KyDenZ commented 3 years ago

@ramseyfeng yes it’s this plugin.

To check if the camera and microphone is allowed, use isCameraAuthorized/isMicrophoneAuthorized.

if allowed, run the session, else use requestMicrophoneAuthorization/requestCameraAuthorization.

ramseyfeng commented 3 years ago

@KyDenZ Thanks for continuous help! I'll try it.

mklipe commented 2 years ago

Has anyone tested this solution with capacitor 3?

ramseyfeng commented 2 years ago

@mklipe Do you mean "cordova-plugin-opentok": "git+https://github.com/enricop89/cordova-plugin-opentok.git#capacitor-support"? Yes, it can work, although it's very old. @KyDenZ Are you still use this solution? Or do you have any better option?

KyDenZ commented 2 years ago

@ramseyfeng The project where I was using opentok is currently without updates, it still works fine. I will have to switch to Capacitor 3 but I am disappointed with the Opentok teams who do not validate the pull-requests !

ramseyfeng commented 2 years ago

@KyDenZ Thanks for the information! Let me confirm, you directly use the latest community plugin: https://github.com/opentok/cordova-plugin-opentok/ with Capacitor 3, and it works well. am I understanding correct?

BTW, which PR you are mentioned? Maybe i can contact the opentok team to have a look, because we have purchase an enterprise license support of vonage.