Use Video chat in background like Skype using WebRTC in Android

  • Replies:2
Faisal Shaikh
  • Forum posts: 1

Apr 10, 2016, 5:56:37 PM via Website

I am trying to implement functionality like Skype i.e while having Audio/Video call I can go to another screen, but the call will continue, and again I can return to the AV calling screen. I am implementing this idea in Android platform.

The problem I am facing is when I switch the screen, the video is paused, but the audio is continuing. Is there any way to make video continue even if I switch the screen.

I used following code to start the Audio/Video conference from VideoChatActivity.java`

app.startLocalMedia(new SingleAction<Exception>() {
        @Override
        public void invoke(Exception ex) {
            if (ex == null) {
                // Start the signalling engine.
                app.startSignalling(new SingleAction<String>() {
                    @Override
                    public void invoke(String ex) {
                        if (ex != null) {
                            // alert("Could not start signalling. %s",
                            // ex.getMessage());
                            alert("Some problem occured while establishing connection");
                            Logger.error("YES-Error at startSignalling " + ex);
                        }
                    }
                }, webasyncURL);
                // Start the conference engine.
                Logger.error("YES-here-1.2");
                app.startConference(iceLinkServerAddress, roomName, video, container, wheel, audioOnlyDefaultAvatar,
                        muteControlToggle, videoOnOffToggle, speakerToggle, videoChatActivity,
                        new SingleAction<Exception>() {
                            @Override
                            public void invoke(Exception ex) {
                                if (ex != null) {
                                    // alert("Could not start conference. %s",
                                    // ex.getMessage());
                                    alert("Some problem occured while initializing video call");
                                    Logger.error("YES-Error at startconference " + ex.getLocalizedMessage());
                                }
                            }
                        });
            } else {
                // alert("Could not start local media. %s",
                // ex.getMessage());
                Logger.error("YES-Error at startLocalMedia " + ex.getLocalizedMessage());
            }
        }
    }, video, audio);

When I back to the previous activity while doing Audio/Video conference I called the service to strat startLocalMedia.

Here is my CameraService.java`

VideoChatActivity.app.startLocalMedia(new SingleAction<Exception>() {
            @Override
            public void invoke(Exception ex) {

                if (ex == null) {
                    // Start the signalling engine.
                    VideoChatActivity.app.startSignalling(new SingleAction<String>() {
                        @Override
                        public void invoke(String ex) {
                            if (ex != null) {
                                // alert("Could not start signalling. %s",
                                // ex.getMessage());
                                //alert("Some problem occured while establishing connection");
                                Logger.error("YES-Error at startSignalling " + ex);
                            }
                        }
                    }, VideoChatActivity.webasyncURL);
                    // Start the conference engine.

                    VideoChatActivity.app.startConference(VideoChatActivity.iceLinkServerAddress, VideoChatActivity.roomName, VideoChatActivity.video, VideoChatActivity.container, VideoChatActivity.wheel, VideoChatActivity.audioOnlyDefaultAvatar,
                            VideoChatActivity.muteControlToggle, VideoChatActivity.videoOnOffToggle, VideoChatActivity.speakerToggle, VideoChatActivity.videoChatActivity,
                            new SingleAction<Exception>() {
                                @Override
                                public void invoke(Exception ex) {

                                    if (ex != null) {
                                        // alert("Could not start conference. %s",
                                        // ex.getMessage());
                                        //alert("Some problem occured while initializing video call");
                                        Logger.error("YES-Error at startconference " + ex.getLocalizedMessage());
                                    }
                                }
                            });
                } else {
                    // alert("Could not start local media. %s",
                    // ex.getMessage());
                    //alert("Some problem occured while getting media devices");
                    Logger.error("YES-Error at startLocalMedia " + ex.getLocalizedMessage());
                }
            }
        }, VideoChatActivity.video, VideoChatActivity.audio);

Reply
David Michael
  • Forum posts: 27

Jan 31, 2019, 3:48:36 PM via Website

Here I suggest build an own platform like skype

Free from Pay per use

Mirrorfly has an inbuilt video chat API solution to setup WebRTC into your server.

Disregard the risk of a monthly subscription or pay-as-you-go concepts. Utilize the unlimited usage of video calling on mobile or web applications with one-time payment options without any interferers.

— modified on Jan 31, 2019, 3:49:57 PM

Reply
Richard
  • Forum posts: 8

Sep 29, 2020, 12:18:26 PM via Website

Several tech stack combinations that can be used to create the video chat app like skype. You have a choice of:

1.SaaS Solutions for Building Video Chat Application: PubNub, OpenTokRTC, Wowza, Twilio, Socket

  1. SaaP Solutions for Build Video Chat Application : MirrorFly, Apphitect IM,CONTUSfly

Programming Languages and Tools to Use for Video Chat App Development: Swift, Java and Kotlin, Bambuser, SDKs, and APIs
Take a look at the comprehensive list of technologies as a recommendation. That said, what you end up using will primarily depend on your app’s specific requirements.

For Android

Android Java, Rest APIs, Android studio
Third-party integration: Pusher, AppLogic (for chatting), PubNub SDK,

For iOS

Xcode, Swift
Third-party integration: PubNub SDK, AppLogic (for chatting), Pusher
For Desktop Application
Socket IO (for chatting)
React & NodeJs

WebRTC is an open-source technology that is most commonly for video connection between devices that enables quick deployment of real-time communication over iOS and Android chat apps possible. If you end you using this solution, then you will have to deal with four API interfaces.

These include:

MediaStream
RTCPeerConnection
RTCDataChannel
OpenTOK

Reply