Giter Club home page Giter Club logo

webrtc-android's Introduction

How the App Works?

A detailed description is addressed in the following article Maximizing WebRTC Potential

Calling App using Web RTC and Java

This project covers an implementation of Web RTC in Java to establish an app to app calling Mechanism.

App to App Calling You will get a UI like attached above.

How to run the app?

To start the application you will need to start the Signalling server. A signalling server helps in sharing the ICE candidates between the peers [it must be over secure medium, i.e. wss], it is build using WebSockets or anyother related library like Socket.io. You can use the signalling server from this repo. Here I implemened a simple websocket based Node Js server that helps in establishing connection between peers.

Starting the Signalling Server

You need to run the following commands for first time execution to install the required packages. yarn or npm install Then you need to start the server using yarn start or npm start

Now you have the signalling server up and running on port :3000 you can edit this port from the index.js file in the repository.

How to add it to the App?

When you open the app code base you will see a SocketRepository class here we have implemented a connection to the Signalling Server

// Here in the place of new URI("") => need to add 
// your connection string in place of the ""
this.webSocketClient = new WebSocketClient(new URI("")) {
                @Override
                public void onOpen(ServerHandshake handshake) {
                    sendMessageToSocket(
                            new MessageModels(
                                    "store_user", username, null, null
                            )
                    );
                }

                @Override
                public void onMessage(String message) {
                    try {
                        onNewMessage(new Gson().fromJson(message, MessageModels.class));
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }

                @Override
                public void onClose(int code, String reason, boolean remote) {
                    Log.d(logTag, "onClose: " + reason);
                }

                @Override
                public void onError(Exception ex) {
                    Log.d(logTag, "onError: " + ex.toString());
                }
            };

How can you get a Secure Connection link to your local Signalling server?

You can use tools like ngrok to get a secure like to your local server. To run the server with ngrok, start the signalling server and run the following commands: ngrok http 3000 This command will give you a secure link to you local server.

ngrok                                                                                                                                                                                        (Ctrl+C to quit)
                                                                                                                                                                                                             
Send your ngrok traffic logs to Datadog: https://ngrok.com/blog-post/datadog-logs                                                                                                                            
                                                                                                                                                                                                             
Session Status                online                                                                                                                                                                         
Account                       [email protected] (Plan: Free)                                                                                                                                   
Version                       3.3.1                                                                                                                                                                          
Region                        India (in)                                                                                                                                                                     
Latency                       -                                                                                                                                                                              
Web Interface                 http://127.0.0.1:4040                                                                                                                                                          
Forwarding                    https://c76d-58-65-176-42.ngrok-free.app -> http://localhost:3000                                                                                                              
                                                                                                                                                                                                             
Connections                   ttl     opn     rt1     rt5     p50     p90                                                                                                                                    
                              0       0       0.00    0.00    0.00    0.00  

The link https://c76d-58-65-176-42.ngrok-free.app is a secure endpoint and can be use with the prefix of wss:// instead of https:// as it is a WebSocket based server. This link should be added as a URI in the SocketRepository class, as discussed earlier.


webrtc-android's People

Contributors

abdullahjankhan avatar

Stargazers

Khalifa avatar

Watchers

 avatar

Forkers

particlecore

webrtc-android's Issues

The video is not streaming

The audio is working fine. But video is not showing up.
Tried to toggle video on&off button but didn't worked!
getting 0 frames from remote view and black screen on two devices

Screenshot 2023-07-29 at 4 23 07 PM

WhatsApp Image 2023-07-28 at 10 04 06 PM

phone phone1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.