ApiRTC / apirtc-react-native-demo

Demo of ApiRTC with react-native
5 stars 4 forks source link

Camera always in use #7

Closed Marco97raf closed 4 years ago

Marco97raf commented 4 years ago

Hi, i'm working on a video call project with an android device, so I started with react-native (and react for web page). I run into a problem with the release of camera. It stay busy also after an hungup. I haven't found any solution in documentation.

I'm using the react native library of this project "apiRTC-React.min.js". Anyone can help me?

Thank you.

FredLuart commented 4 years ago

This is fixed on the last demo update. Can you test it ?

Marco97raf commented 4 years ago

Yes, I imported the new file apiRTC-React.min.js, but when the app starts this error occurs: "document.addEventListener is not a function" on line 3:526341 of the minified file.

FredLuart commented 4 years ago

Hi, I will check it, is it on iOS or Android ?

Marco97raf commented 4 years ago

Sorry, it is on Android

FredLuart commented 4 years ago

Hi, I was not able to reproduce your issue but I have pushed an update that should fix it. Can you test it ?

Marco97raf commented 4 years ago

I tested the last update. "document.addEventListener is not a function" this problem no longer comes out, but the camera continues to remain busy after hungup.

FredLuart commented 4 years ago

did you update ReactNativeApiRTC.js ?

    invitation.accept()
        .then((call) => {
            this.setCallListeners(call);        
            this.currentCall = call;
        });

});

Marco97raf commented 4 years ago

Yes, I use the same logic for my project.

FredLuart commented 4 years ago

Can you reproduce on our sample ? I think It is corrected on our sample with the additional : this.currentCall = call;

Marco97raf commented 4 years ago

I found the problem, passing the stream created with "apiRTC.Stream.createStreamFromUserMedia(null,null, constraints)" the camera is not released. While without passing the stream to "invitation.accept()" the camera is released. Is there a way to pass constraints to invitation.accept()? I need to lower the frame rate and increase the resolution. Thank you

FredLuart commented 4 years ago

It is normal behavior, if you create the stream on application you need to manage the stream.release() : if stream is created with the call, we release it. You can pass a stream with your needed constraint to accept()

I am closing the issue as it is resolved