vivek1794 / webrtc-android-codelab

An attempt to provide a codelab for Webrtc in Android - Similar to codelab for web at https://codelabs.developers.google.com/codelabs/webrtc-web/
MIT License
238 stars 124 forks source link

Step3 is not working. #10

Open jense-arntz opened 6 years ago

jense-arntz commented 6 years ago

I have run the step3 application on Chrome Browser and Android app. Localvideo is working and remote video is not working.... what I missed?

vivek1794 commented 6 years ago

The step-3 browser code may not be right. Check how the data is transferred (SDP and ice candidates). I did not concentrate on the web part and copied it from the webrtc codelabs. Android app code might be sending the data in a different format (JSON) than what the web is expecting. You can make the required changes to the js file to parse the data. Send me a PR if you made it work.

jense-arntz commented 6 years ago

Thanks Vivek. as you mentioned above, android code will be working properly? I only need to make the browser code working?

jense-arntz commented 6 years ago

Hi Vivek

vivek1794 commented 6 years ago

Hi @jense-arntz yes the android to android part would be working. You need to make some changes to the browser code to make it work for Android <-> browser

jense-arntz commented 6 years ago

Error is "Class CustomCameraEventsHandler.java must either be declared abstract or implement abstract method 'onCameraOpening(String)' in 'CameraEventsHandler'

-Issue on STEP3. There is no error occurred on Browser and Android when building peerconnection and completing the process 'Offer' and 'Answer'. I am suspicious if there is issue on iceserver.

Please help. thanks.

jense-arntz commented 6 years ago

Please give me some hints.

vivek1794 commented 6 years ago

@jense-arntz : The step-2 needs to be updated. Please refer to step-3 code for how to handle peer connection. WebRTC has removed many of the methods used in Step-2.

Step-3 browser to android would not work as I said earlier. Browser side code needs to be changed to accept offer and answer signalling messages in JSON format just as the Android client would expect.

darwish1994 commented 6 years ago

as i understand from tutorial ( part 1 -- 4 ) the single server in that project is sokect io server i make a local server like this https://codelabs.developers.google.com/codelabs/webrtc-web/#6 and replace the url (" your_socket_io_instance_url_with_port") in SignallingClient class but remote vedio not work

pavelsust commented 6 years ago

image

This constructor gives me error. How you solved this error??

ghost commented 6 years ago

change build.gradle to this : implementation 'org.webrtc:google-webrtc:1.0.22672' to solve constructore and VideoRenderer error

pavelsust commented 6 years ago

@arfa-maddi @vivek1794 @darwish1994 can any people help me about key.pem. When i run signalling project i can't find any key.pem. Where i can find this?? or i have to make it own.

skumarm commented 6 years ago

1.0.22672

Yes. this fixed my issue on VideoRenderer error

ArjunHalli commented 6 years ago

Appliaction is crashing on launch and gives the error xyz.vivekc.webrtccodelab E/AndroidRuntime: FATAL EXCEPTION: main Process: xyz.vivekc.webrtccodelab, PID: 11587 java.lang.NullPointerException at xyz.vivekc.webrtccodelab.MainActivity$1.onResponse(MainActivity.java:106)

neilyoung commented 6 years ago

@arfa-maddi You could create your own key.pem and cert using openssl for creating self signed certificate. @skumarm I think the Java code is not prepared to get not a valid answer while asking for iceServers at the signaller.

You could workaround by changing the code starting at line 103 like so:

 if (body != null) {
                    iceServers = body.iceServerList.iceServers;
                    for (IceServer iceServer : iceServers) {
                        if (iceServer.credential == null) {
                            PeerConnection.IceServer peerIceServer = PeerConnection.IceServer.builder(iceServer.url).createIceServer();
                            peerIceServers.add(peerIceServer);
                        } else {
                            PeerConnection.IceServer peerIceServer = PeerConnection.IceServer.builder(iceServer.url)
                                    .setUsername(iceServer.username)
                                    .setPassword(iceServer.credential)
                                    .createIceServer();
                            peerIceServers.add(peerIceServer);
                        }
                    }
                    Log.d("onApiResponse", "IceServers\n" + iceServers.toString());
                }
            }

EDIT: However, this project seems to be abandoned.

vivek1794 commented 6 years ago

I did not find the time to update the project. Please raise a PR so that we can keep it updated.

Also, WebRTC changes their class names and methods so often that it is difficult to keep it updated for the current version. It should, however, work with the AAR file attached in this repo.

chutongz commented 5 years ago

@arfa-maddi You could create your own key.pem and cert using openssl for creating self signed certificate.

@neilyoung Hi, I am having issue about key.pem and cer.pem. Should I just write the id_rsa and id_rsa.pub location (which ssh generated when the git configuration) down to replace key.pem and cer.pem?

ghost commented 5 years ago

@chutongz Your signaling server needs to be available as secure server. For that you need to either provide a "real" certificate or you can create your own self-signed certificate. There are tons of articles on the web regarding "How to create self-signed certificate using openssl". However, modern browsers meanwhile are making problems accepting a self-signed certificate, so in case you need to convince browsers that you are a trusted CA you need to do a bit more (or to take care about a little bit more) the time you are creating your self-singed certificate. This is excellently explained in this post https://fabianlee.org/2018/02/17/ubuntu-creating-a-trusted-ca-and-san-certificate-using-openssl-on-ubuntu/

chutongz commented 5 years ago

@accuware Hi, thank you so much for replying me! Now I used openssl to create the key.pem and cert.pem already, but when I try the command "node index.js", it gave me error as below: tim 20181203160725 Do you have any idea of this error? Is it because some thing wrong when I create the certification?

neilyoung commented 5 years ago

@chutongz Sorry, used the wrong account. It was me :) There is for sure a format problem. The cert is expected to be Base64 text, IMHO

chutongz commented 5 years ago

@neilyoung Yes, I recreate the certification and run the command but nothing happend... Nothing returned, nothing printed... I waited for so long.... I am so confused and wondering if it comes up with the socket.io url? Because I haven't set it yet... tim 20181203164934

neilyoung commented 5 years ago

Well, I'm neither the creator nor a contributor of this app....

Once you have setup the server you should be able to test the connection using

telnet your.server 443

or whatever port the server is listening to.

chutongz commented 5 years ago

@neilyoung OK! I'll try it anyway. Thanks so much for replying me again! :)

mmarashan commented 5 years ago

Hello everyone! Check that remoteVideoTrack.addRenderer(new VideoRenderer(remoteVideoSurfaceViewRender)); or remoteVideoTrack.addSink(remoteVideoSurfaceViewRender); call after ALL ICE exchange occurred. It depends on signalling and can cause a heavily detectable error