Giter VIP home page Giter VIP logo

atyenoria / react-native-webrtc-janus-gateway Goto Github PK

View Code? Open in Web Editor NEW
192.0 12.0 76.0 1.76 MB

Video conference system for mobile application. Base technology is react-native-webrtc + Janus Webrtc Gateway

Home Page: https://github.com/atyenoria/react-native-janus-gateway-webrtc-video-chat

JavaScript 94.14% Python 1.28% Java 1.26% Objective-C 3.24% C 0.08%
react-natvie webrtc ios andorid janus-gateway react

react-native-webrtc-janus-gateway's Introduction

Demo

demo

How it wokrs?

work

Application

Dependent Libaries

  • "react-native": "^0.50.3",
  • "react-native-webrtc": "^1.58.3"
  • "react-native-incall-manager": "^2.2.0"
  • "react-native-vector-icons": "^4.4.2"
  • "react-native-elements": "^0.18.2"
  • "react-native-tab-navigator": "^0.3.4"
  • "react-native-gifted-chat": "^0.3.0"

Functionality

  • Janus WebRTC Gateway Video Room Implementation
  • Mobile users can send teh audio and video msg to other paritciapnts up to 6 max (can configure in janus)
  • Friendly text chat

TODO

  • iOS works
  • Android works
  • Janus Plugin Demo: Video Room works ( https://janus.conf.meetecho.com/videoroomtest.html )
  • Local camera view
  • Remote view
  • Audio mute
  • Video mute
  • Audio Speaker
  • Unpublish and publish
  • Switch front and back camera with react-native-webrtc MediaStreamTrack.prototype._switchCamera()
  • End call
  • Problem: the delay of receving remote viedeos increases when recreating the webrtc session by unpublish/publish. Soulution: use janus.destroy() for republishing instead of unpublish and publish
  • Rerender teh remote video view if others join and leave continuously
  • Rerender my video view when publishing and unpublishing
  • Switching camera works after recreating the session
  • Connecting modal when creating session
  • Redux integration
  • Better handling the janus session by simple redux
  • Better restarting the the janus session by simple queue system
  • Text Chat Mock
  • Rich UI
  • Refactor index.js and janus.mobile.js
  • More Details about how to use this Documentation
  • PR to awesome-react-native ( https://github.com/jondot/awesome-react-native )
  • Other Janus Plugin(Audio bridge, Streaming, Sip, Video Call ... etc)

Setup for iOS and Android

Setup for iOS

  • Code Signing for building on real device
  • Change the node path for you env, Build Phases -> Bundle React Native code and images ("export NODE_BINARY=/Users/jima/.nodebrew/current/bin/node")
  • Build the iOS project in release or debug

Setup for Android

License

  • MIT

Contributor

  • @atyenoria

Any request and bug repoting?

  • Could you create a new issue?

react-native-webrtc-janus-gateway's People

Contributors

atyenoria avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-webrtc-janus-gateway's Issues

WebRTCModule/GetUserMediaImpl.java videoConstraintsMandatory : Null pointer exception

@atyenoria ,
I encountered a null pointer exception when I tried to run the Android sample with videoConstraintsMandatory in react-native-janus-gateway-webrtc-video-chat/node_modules/react-native-webrtc/android/src/main/java/com/oney/WebRTCModule/GetUserMediaImpl.java

When I changed the code from

        // Fall back to defaults if keys are missing.
        int width
                = videoConstraintsMandatory.hasKey("minWidth")
                ? videoConstraintsMandatory.getInt("minWidth")
                : DEFAULT_WIDTH;
        int height
                = videoConstraintsMandatory.hasKey("minHeight")
                ? videoConstraintsMandatory.getInt("minHeight")
                : DEFAULT_HEIGHT;
        int fps
                = videoConstraintsMandatory.hasKey("minFrameRate")
                ? videoConstraintsMandatory.getInt("minFrameRate")
                : DEFAULT_FPS;

to this instead

    int width, height, fps;
    // Fall back to defaults if keys are missing.
    if (videoConstraintsMandatory != null) {
         width
                = videoConstraintsMandatory.hasKey("minWidth")
                ? videoConstraintsMandatory.getInt("minWidth")
                : DEFAULT_WIDTH;
        height
                = videoConstraintsMandatory.hasKey("minHeight")
                ? videoConstraintsMandatory.getInt("minHeight")
                : DEFAULT_HEIGHT;
        fps
                = videoConstraintsMandatory.hasKey("minFrameRate")
                ? videoConstraintsMandatory.getInt("minFrameRate")
                : DEFAULT_FPS;
    } else {
        width = DEFAULT_WIDTH;
        height = DEFAULT_HEIGHT;
        fps = DEFAULT_FPS;
    }

then the react-native-janus-gateway-webrtc-video-chat VideoRoom sample worked. Did you encounter a similar issue and if yes, what is the proposed work around? I know you state that android is still a work in progress but I was impatient and wanted to give it a whirl

Thanks

ios green indicator

I have a problem. When i initiate a call with this plugin and finish them i have green indicator in ios.
This indicator means what something is recording.

Have any ideas how to fix it?

not compiled on Xcode8.0.

Hi.
Your source works well on Android.
and I've tried to compile your source on Xcode8.0.
But it is not compiled.
screen shot 2016-10-09 at 1 50 17 pm
And shows such error.
screen shot 2016-10-09 at 1 50 47 pm
Why is like that?
Thanks

node-janus library in react native

Hi.
You made a very nice repo here.
Just checked and one question please.
You've mentioned that by this repo can also use Nolan's node-janus library.
Could you explain me how to do that?
Any samples or explanations?

Getting error when access camera

FATAL EXCEPTION: main Process: com.classmiles.student, PID: 26949 java.lang.NullPointerException: Attempt to invoke interface method 'boolean com.facebook.react.bridge.ReadableMap.hasKey(java.lang.String)' on a null object reference at com.oney.WebRTCModule.GetUserMediaImpl.getUserVideo(GetUserMediaImpl.java:395) at com.oney.WebRTCModule.GetUserMediaImpl.getUserMedia(GetUserMediaImpl.java:293) at com.oney.WebRTCModule.GetUserMediaImpl.access$000(GetUserMediaImpl.java:29) at com.oney.WebRTCModule.GetUserMediaImpl$1.invoke(GetUserMediaImpl.java:257) at com.oney.WebRTCModule.GetUserMediaImpl$3.invoke(GetUserMediaImpl.java:458) at com.oney.WebRTCModule.PermissionUtils$2.onReceiveResult(PermissionUtils.java:189) at android.os.ResultReceiver$MyRunnable.run(ResultReceiver.java:50) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5253) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:913) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:708)

Streaming video is not displayed in both iOS and android phones !

Hello, I'm trying to display a remote streaming video but i succeed to connect to janus library but i get at the end a black screen instead of video content. Any idea about this issue please?
Am using the same library janus.mobile.js
In my Video component i call janusStart this way:

janusStart = () => {
containerStreaming.setState({ visible: true });
Janus.init({
debug: [],
callback: function() {
let streaming = null;
let janus = new Janus({
iceServers: this.state.iceServers,
server: this.state.server,
token: this.state.token,

                error: function(error) {
                    Janus.error('Janus  -- ' + error);
                    Janus.error('Destroying Janus');
                    janus.destroy();
                },
                destroyed: function() {
                    Janus.log('Janus ' + name + ' -- ' + 'Janus session destroyed');
                },
                success: function() {
                    janus.attach({
                        plugin: 'janus.plugin.streaming',
                        success: function(pluginHandle) {
                            streaming = pluginHandle;
                            Janus.log(`Janus Plugin Attached : ${pluginHandle.getId()}`);
                            streaming.send({ message: { request: 'watch', id: this.state.id } });
                        },
                        error: function(error) {
                            Janus.error(`Error Attaching Janus Plugin ${error}`)
                        },
                        onmessage: function(msg, jsep) {
                            console.log("jsep" ,jsep.sdp);
                            Janus.log(`Janus Message received : ${JSON.stringify(msg)} and jsep ${jsep}`);
                            var result = msg['result'];
                            if (!!result && result['status'] == 'stopped') {
                                janus.destroy();
                                return;
                            }
                            if (jsep !== null && jsep !== undefined) {
                                Janus.log(`JANUS : Handling SDP as well : ${jsep}`);
                                streaming.createAnswer({
                                    jsep: jsep,
                                    media: { audioSend: false, videoSend: false }, // recvonly
                                    success: function(jsep){
                                        Janus.debug(`Janus Got SDP : ${jsep}`)
                                        streaming.send({ message: { request: 'start' }, jsep: jsep });
                                    },
                                    error: function(error) {
                                        Janus.error(`Janus WebRTC error : ${error}`)
                                    }
                                });
                            }
                        },
                        onremotestream: function(stream) {
                            Janus.log('Janus Remote stream detected');
                            Janus.log(stream);
                            containerStreaming.setState({status: 'streaming', info: 'Streaming'});
                            containerStreaming.setState({selfViewSrc: stream.toURL()});
                            console.log("stream done")
                        },
                        oncleanup: function() {
                            Janus.log('Janus clean up notification')
                        }
                    })
                }
            });
        }
    })
};

I'm using webrtc to display the streaming video this way :

Note:
Versions:
react-native-webrtc : 1.75.3
RN: 0.60.5
Xcode : 11.3.1
Tested on real iphone device with os version 13
Latest androidStudio version.

SIP support

Any interest for adding SIP support? I could help fund it if possible.

Cannot connect to janus server

My config:
JanusWssHost: 'ws://10.0.10.53:8088/janus', or 8188, wss://... i have tried it all before, but still get cannot connect message in this app.
I installed janus docker and can access to: localhost, but cannot accest to localhost/janus, it gave me 404 not found. Please guide me how to use it. Thanks

Build failed android

Dear,

i followed these commands to build and run for android.

  • install Buck
  • npm start - to start the packager
  • cd android
  • keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"
  • ./gradlew :app:copyDownloadableDepsToLibs - make all Gradle compile dependencies available to Buck
  • buck install -r android/app - compile, install and run application

Prior theses commands, i did :

Unfortunately, on step ./gradlew :app:copyDownloadableDepsToLibs

i get the following build error :

:WebRTCModule:compileReleaseJavaWithJavac
:WebRTCModule:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
An exception has occurred in the compiler (1.8.0_251). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
com.sun.tools.javac.code.Symbol$CompletionFailure: class file for java.lang.invoke.MethodType not found
:WebRTCModule:compileReleaseJavaWithJavac FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':WebRTCModule:compileReleaseJavaWithJavac'.

Compilation failed; see the compiler error output for details.

Could you please help,

Regards,

Yours,

Bertrand

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.