cordova-rtc / cordova-plugin-iosrtc

Cordova iOS plugin exposing the WebRTC W3C API
MIT License
690 stars 338 forks source link

Can't get a valid MediaStream from the camera and microphone #709

Closed nikita-dev-021 closed 3 years ago

nikita-dev-021 commented 3 years ago

YOU MUST read first!

Please use Community Forum for general technical discussions and questions.

Note: If the checkboxes above are not checked (which you do after the issue is posted), the issue will be closed, removing this checkbox will result in automatic closed issue.

Versions affected

Description

I am using a plugin for an Ionic Framework application. For some reason the plugin doesn't work as expected for me. I cannot access the camera and microphone of the device. When I try to use the plugin to receive a stream from a camera or microphone I only get a black screen. I also tried to use the plugin on the cordova environment, but I get the same result. Using https://github.com/cordova-rtc/cordova-plugin-iosrtc-sample I get exactly the same result. The plugin does not seem to access the camera and does not display anything.

I noticed that when using iosrtc.getUserMedia or just iosrtc.requestPermission, the console displays information that video authorization: not determined. Perhaps this may be the reason, but how do I fix it then? In the ionic application, I have added all the necessary descriptions for the permissions in the Info.plist. Cordova adds these descriptions itself. So what could be the problem? I made a simple cordova example that should work, but in my case the video tag just displays a black screen: https://github.com/nikita-dev-021/iosrtc-test

Apparently, there is no analog of the WebRTC plugin for ionic and cordova for ios, so I had high hopes for your plugin. I would be incredibly grateful for your answer!

Steps to reproduce

Add the cordova-plugin-iosrtc plugin to the newly created cordova project and try to get the camera or microphone stream using iosrtc.getUserMedia. Or use https://github.com/cordova-rtc/cordova-plugin-iosrtc-sample

Expected results

Receive video stream from camera or microphone

Actual results

Getting black screen in video tag

hthetiot commented 3 years ago

@nikita-dev-021 I will try to check https://github.com/cordova-rtc/cordova-plugin-iosrtc-sample sample is working as expected and comeback to you.

nikita-dev-021 commented 3 years ago

Thank you!

nikita-dev-021 commented 3 years ago

@hthetiot hey mate! Just checking on you :) Do you have any news? I was also working on solving this issue but it seems that you are my last hope

hthetiot commented 3 years ago

Using https://github.com/cordova-rtc/cordova-plugin-iosrtc-sample I get exactly the same result. The plugin does not seem to access the camera and does not display anything.

Just tested the sample work PERFECTLY for me.

  1. Install

    git clone git@github.com:cordova-rtc/cordova-plugin-iosrtc-sample.git
    cd cordova-plugin-iosrtc-sample
    cordova platform add ios
  2. Build

    Open Xcode
    Open Project file Cordova iOSRTC Sample.xcworkspace
    Change Bundle Identifier to yours
    Build on device

Tested on iPhone with iOS 15.0 and iPad Pro with iOS 14.8

Image from iOS

Image from iOS

Conclusion is: not reprocing the issue.

Possible solution, Did you check that you have authorized the camera, because if you refuse once, you need to go in settings and make sure it is authorized again, or remove the app and install again.

Image from iOS (1)

hthetiot commented 3 years ago

Tested with https://sylaps.com via open-easyrtc no problem works perfercly via index-easyrtc

Image from iOS (2)

Do you even have TURN and STUN server setup? @nikita-dev-021

If you do check it works on your device networks:

hthetiot commented 3 years ago

You cannot call "cordova.plugins.iosrtc.registerGlobals();" before cordova is ready in the file, it will not works. https://github.com/nikita-dev-021/iosrtc-test/blob/master/www/js/renderer-and-libwebrtc-tests.js#L7

hthetiot commented 3 years ago

That it unless there is proper way to reproduce using the sample, i will not provide more free support. For paid support via service you can contact support@sylaps.com

hthetiot commented 3 years ago

See ionic sample here tested and also works as expected https://github.com/cordova-rtc/ionic-iosrtc-peerjs