Building a video Streaming App using WebRtc And Along With Peer to peer connection Locally? - swift3

Is it possible to use the WebRtc Offline. When we connect 2 devices through peer to peer connection After that WebRtc for streaming the video Which we want to set it through offline which we don't want to use the internet for every time. Is this Method is possible to Implement using WebRtc.
How can We set the Quality of the Video using WebRtc. Every time it Works as its Default Quality Streaming. How can we Improve Its Quality.
https://github.com/Mahabali/BonjourWebrtc
I just gone through the Link it is pretty good using WebRtc and Peer to peer Connection. But if the Internet is not their it is not Work. How can I overcome this Problem. Is it possible to set Offline using WebRtc and How I improve the Quality of the Video.
Sorry For my Bad English hope anyone help me to overcome this.

As explained on the blog of the BonjourWebRtc project : https://mobilitysolutionsexpert.wordpress.com/2016/05/04/server-less-or-no-server-webrtc-ios-app/, it used a Google Stun server.
So if you want to used it offline, you have to host your own Stun server on a local server. You can easily find code for Stun server on the web, juste google it.

Related

GStreamer with WebRTC, OpenCV-Server-Client

I don’t know if I can say “I’m sorry for ask” but I spent more than a week looking for a solution without success. I have a Jetson Nano and with OpenCV I get and process an image at 4fps, I need to send this video to a web server to allow the client connected to the server get the video. Everything need to be written in C++.
Because a need a low latency I did test with GStreamer and WebRTC without success. I don’t have any web server ready, so I can use any implementation.
Anyone know where I can find some example implementation with this schema?
You can use mediasoup to send data to the server to then send the stream with rtp to another endpoint like gstreamer or ffmpeg.
Here is a recording project where data is sent from the browser -> server -> gstreamer -> file.
Mediasoup is written in c++ and has a wrapper for js.
I had similar problem and used such example from GStreamer WebRTC official repo. It's written in Python for Janus Gateway video rooms but I think it can be easily rewritten in C++ as you need.
In the code for OpenCV, I used V4L2Loopback as a virtual output device to be used as input for GStreamer WebRTC example.
I hope such approach may help you.
I think no need to send it to a Web Server. In Gstreamer examples [https://github.com/GStreamer/gst-examples]. The SendOnly example sends a video to a Web Client Using WebRTC. You can modify it to send an OpenCV mat.

stream audio from browser to WebRTC native C++ application

I manged to run WebRTC peerconnection example, but it is not running on the browser.
I'm trying to find a way to stream both video and audio from browser to my native program.
Is there any way?
It can be done. WebRTC is designed to work in a peer-to-peer manner between two WebRTC agents (typically a Web Browser). Your native program needs to become the second peer.
If you need to rely on open source components a good starting point is:
OpenSSL for the DTLS key exchange.
libsrtp to encrypt the RTP packets.
ffmpeg to decode the PCM audio from the browser (libvpx if you need to do video).
You'll also need to handle the ICE negotiation which requires processing STUN messages. Also extract the media payloads from the RTP packets. All these steps are also after you've determined a signalling method to exchange the SDP offer and answer between you app and the browser.
As you've probably realised starting from scratch it's a major task. There are probably some commercial libraries that will do the job and save you a lot of pain.
If that doesn't scare you and you do still want to make an attempt using open source components this example "may" help. The sample is doing the reverse of what you've asked and is sending a video stream to Chrome rather than receiving an audio stream. The useful aspect is the connection negotiation. The sample program is able to get RTP packets flowing which is often the main problem.
The example is also using Windows Media Foundation which is Windows specific. It also has lots of shortcuts particularly with the RTP and STUN packet processing.

gSoap: Connects over Wired network but TCP error over any wireless network

I have just started using gsoap and after spending a lot of time i have successfully included it in my project and have started to use it. The problem which has been troubling me for past many days is that when i hit a service,it connects over LAN,the connection is established but when i switch over to any wireless network connection doesn't establish,I debugged into the code and found that the connection could not be established over wireless network which results in connection timeout after apt retries.I am unable to figure out why this happens i.e why connection is not established over wireless networks,can anyone guide me as i am a newbie with gSoap and network programming as well. Any help would be appreciated.
I got the SOAP service hit and there was no problem of wired or wireless connection.Basically what I was doing was hitting the service from windows platform(msvc compiler) which was over LAN and then i was trying to integrate the same code with clang compiler to generate a .so to run it on an Android platform. I was getting a proper response when hitting from windows but when hitting from Android I got a TCP error.I could not find any issue in the code when I posted the question and the only difference I could see was connection type of two platforms but there was an underlying issue in integration over android due to which the error was getting generated and I resolved it and now the service is getting hit on both platforms.
GSOAP works like a charm over a network irrespective of the type(wired or wireless) so do not go astray after looking at the question thinking it can be a problem,if u think you have a similar issue,I would recommend looking into other things rather than wasting your time thinking it to be an issue like I did.

How to incorporate ports / sockets for direct tunneling with p2p darknet app

I'm building an app which upon login will connect you to certain ip addresses of which will also be running the same app.
The method of which i believe i should be using is direct tunnelling but as i say im a little new to c++, i have general coding skills, and i have sifted through a lot of forums and sites yet im still very unclear on what the best way forward is to achieve the requirement.
The reason for the connection will be to enable a secure chat, file transfer, and update software auto when connected to the program admin.
All those that have the app installed will once authorised, will be connected to admin client, then from that client all available ip's to connect to will become available to slave clients, this will increase the network size avilable to all users.
so the app needs to be able to handle ports but not via a server, instead it would be direct.
The connections also must ideally be encrypted.
Im kind of looking for what the application RetroShare does, but in text app.
(This is using C++ within Dev C++)
so just to recap, What method should i use to achieve the above?
I would take a look at SDL net to start with, its really simple to learn if you have never done any socket programming before.
for a secure connection you will probably want to start with TCP and then once you get the hang of network programming, start looking at other protocols.
Hope this helped! and good luck.

Creating C++ client app for some abstract windows server - how to manage TCP connection to server speed?

So we have some server with some address port and ip. we are developing that server so we can implement on it what ever we need for help. What are standard/best practices for data transfer speed management between C++ windows client app and server (C++)?
My main point is in how to get how much data can be uploaded/downloaded from/to client via his low speed network to my relatively super fast server. (I need it for set up of his live stream Audio/Video bit rate)
My try on explaining number 3.
We do not care how fast is our server. It is always faster than needed. We care about client tyring to stream out to our server his media. he streams encoded (via ffmpeg) live video data to our server. But he has say ADSL with 500kb/s of outgoing traffic. Also he uses some ICQ or what so ever so he has less than 500 kb/s per second. And he wants to stream live video! So we need to set up our ffmpeg to encode video with respect to the bit rate user can provide. We develop server side and client side. We need a way of finding out how much user can upload per second currently (so value can change dynamically over time)
Check this CodeProject Article
it's dot-net but you can try figure out the technique from there.
I found what I wanted. "thrulay, network capacity tester" A C++ code library for Available bandwidth tracking in real time on clients. And there is "Spruce" and it is also oss. It is made using some of linux code but I use Boost library so it will be easy to rewrite.
Offtop: I want to report that there is some group of people on SO down voting on all questions on this topic - I do not know why they are so angry but they deffenetly exist.