in the last days I seen a technology called WebRTC that permit directly in Javascript to make p2p connections. What I've said to myself is: can i make complex web apps, like forums or social networks, that actually need databases to work fine, with WebRTC and p2p connection? Can someone tell me if is it possible and how it can be do this.
Sure, you can do it, any project complexity can be implemented using WebRTC API
WebRTC is a kind of standard now for audio/video p2p communication at this moment, so almost any projects that have audio/video calls use WebRTC API - at browser side, and also at iOS/Android
Here is an open source example of 1-1 and group video chat app, which uses WebRTC API broadly
Related
I'm working on a project which involves building an audio-conferencing app for the web. Currently my working system uses a WebSocket server to negotiate connections between peers, which can then stream audio directly to one another. However, I wish to implement the server as its own client/peer, which will receive all incoming audio streams, "mix" them into a single source/stream, and then stream it to all peers individually. The goal is to avoid direct peer-to-peer connections between user connections.
Perhaps a more simple question would be how I can accomplish the concept of the given figure, the green squares being RTCPeerConnections, and the server "forwarding" the incoming streams to the recipient?
Figure
How can I accomplish this, and is the concept feasible in regards to system resources of the server?
Thanks.
You can use kurento. Its based on webRTC and its Media Server features include group communications, transcoding, recording, mixing, broadcasting and routing of audiovisual flows.
The concept you are looking for is called Multi Conferencing Unit (MCU). MCU is not part of standard WebRTC. WebRTC is peer-to-peer only.
There are several media server solution that offer the MCU functionality. kurento, as suggested by Milad, is one options. Others examples are Jitsi Videobridge or Janus.
A more recent approach you might want to consider is SFU (Selective Forwarding Unit).
I am developing an application in RN which sends the video from the front camera.
I tried using WebSockets and SocketIO, but that only helps with text transfer.
Also, I know about WebSocketStream in Js but I just can't find any implementation in python.
Guide me please.
Websocket is not suitable for this type of applications. you can use technologies like WebRTC for this this purpose. take a look at these technology and frameworks to see which one fit your needs.
webRTC: for p2p connection
kurento: webRTC media server
hls and live streaming technologies
webRTC is a technology developed by google for real-time P2P communication. You can use webRTC to connect two or more end user together and send Data/Audio/Video. Read following resources for more information.
webRTC
React Native Implementation
But its only offer P2P connection for you. If you want to store/modify/broadcast your streams you must use something like Kurento media server.
I'm new to WebRTC, actually just heard about it a few days ago and I've read a lot about it. However, I still have a few questions.
What do I need to explore the usage of WebRTC? E.g.: do I need a server, any libraries etc.? I'm aware that new version of Chrome and Firefox support WebRTC, but besides these two browsers, is there anything else that is necessary?
What is the main purpose of WebRTC when addressing practical usage? To video chat? Audio chat? What about text-chatting?
Does WebRTC need a server for any kind of browser-to-browser interaction? I've seen some libraries, such as PeerJS that don't explicitly mention any kind of server... so is it possible to connect two clients directly? There's also a PeerServer, which supposedly helps broker connections between PeerJS clients. Can I use WebRTC without such a server?
What are the most commonly used libraries for WebRTC?
What's a good starting point for someone who's totally new in WebRTC? I'd like to setup a basic google-talk kind of service, to chat with one person.
Thank you so much guys.
You can find many docs here E.g. this one, this one and this one!
You can find a few libraries here.
A simple multi-user WebRTC app needs following things:
Signalling server to exchange sdp/ice/etc. ---- e.g. socket.io/websockets/xmpp/sip/XHR/etc.
ICE server i.e. STUN and/or TURN; to make sure Firewalls doesn't block UDP/TCP ports
JavaScript app to access/invoke RTCWeb JavaScript API i.e. RTCPeerConnection.
It just takes a few minutes to setup WebRTC peer-to-peer connection. You can setup peer-to-server connections as well where media-servers can be used to transcode/record/merge streams; or to relay to PSTN networks.
WebRTC DataChannels can be used for gaming, webpage synchronizing; fetching static contents, peer-to-peer or peer-to-server data transmission, etc.
What do I need to explore the usage of WebRTC? E.g.: do I need a
server, any libraries etc.? I'm aware that new version of Chrome and
Firefox support WebRTC, but besides these two browsers, is there
anything else that is necessary?
WebRTC it is JavaScript API for web developers which can be used for audio and video streaming.
But there are 2 notices:
You need a signaling path.
For example, if your first user is Alice using Firefox and second user is Bob using Chrome,
they should negotiate used codecs and streams.
WebRTC does not offer the signalling implementation. So you need to implement the signaling yourself. It is quite simple. You need to send SDP(stream config) to participant and receive an SDP answer. You can use plain HTTP via apahe server or use Websockets or any other transport to negotiate SDP.
So, it seems you need an intermediary signaling server workning with websockets or HTTP/HTTPS.
Once you negotiated the streams you are sending your audio or video stream, but the distanation user might have a simmetric NAT. It means that you stream will not be delivered to the target user. In such situation you need a TURN server to traverse the NAT.
Finally you will need 2 server-side logic items:
1) Signaling server
2) TURN or proxy server
To start, take a look Web Call Server.
The server implements HTML5 Websocket signaling and SRTP proxying as a TURN server.
You can also learn the webrtc application open source code.
First steps:
1. Download the signaling and streaming server.
2. Download and unzip web client.
3. Start the web client and debug javascript code to learn more how webrtc works.
I want to stream video between 2 clients without passing it through the server
Each side sends real time video and also receives the other sides real time video
Is there an open source project that allows that?
Is there an API for that? I'm willing to pay
I want to create it in web app for mobile
Js, html, Ajax, websockets, css...
Thank you so much
VLC has a built in streaming server, as well as the gui it can be use via the comand line so could be scripted to suit your requirements
http://www.videolan.org/doc/streaming-howto/en/
If you stream video directly from one client to another, then you have to understand between two networking models: client-to-server and peer-to-peer.
Server usually is static machine, with networking infrastructure, static ip and many things that allows accessibility by public.
With peer-to-peer you will face many problems, first of them is going through NAT when you creating socket for receiving. One of client might need to create socket to accept connection, and second to accept. They might do both simultaneously and stick to first connected.
Streaming video using web is not possible right now. There is only some beta development happening for Chrome and FireFox that will be publicly available not really soon.
As well you can't establish peer-to-peer connection using WebSockets.
So there is no way doing it using Web technologies.
You might want to have a look into native Mobile development, but there you will face problems with peer-to-peer connections as well.
To clarify when I ask about browser to browser communication I mean without a server in between forwarding message. I would like to implement something like this for a game. If p2p in websockets isn't possible are there similar alternatives? Any help is appreciated.
No. Browsers can only initiate WebSockets connections, not receive them. The W3C browser API spec only defines how to start an outbound connection.
You can make an application that would both initiate and accept WebSockets connections, but browsers do not do this.
You might look at Pusher App which you could use to build a WebSockets application with multiple clients. The service provides up to 20 simultaneous WebSockets clients for free (you can pay for higher scaling).
Update:
The WebRTC protocol and API is making rapid progress and allows a Data Channel to be established between two peers (you still may need a STUN/TURN server for the initial NAT traversal and setup).
In theory it is possible with WebRTC DataChannel:
RTCDataChannel is a WebRTC API for high performance, low latency,
peer-to-peer communication of arbritary data. The API is
simple—similar to WebSocket—but communication occurs directly between
browsers, so RTCDataChannel can be much faster than WebSocket even if
a relay (TURN) server is required (when 'hole punching' to cope with
firewalls and NATs fails).
"In theory" because it isn't supported by a stable browser yet and you still need a relay server (TURN) if one of the browsers is behind a symmetric NAT. Nevertheless, it is a really promising feature.
Update: Chrome 26 and Firefox 22 support RTCDataChannel by default and Firefox 19-21 if you enable WebRTC by setting media.peerconnection.enabled to true (about:config).
I was reading about websocket and peer 2 peer and found PeerJS.
I still haven't made anything though, but by the examples it looks promising.
Now days it's possible, currently only Chrome,FF and Opera support it (desktop).
There's some libraries starting to pop up around the web right now, such as PeerJS and js-platform-p2p which pretty much simplifies things.
Simple and reliable cross browser supported way is to use http://httprelay.io with AJAX calls. It is also implements one to many communication what could be useful for game development.