Flutter Webrtc - 3 Peer connection - flutter

I am creating a 3 peer Webrtc Flutter app. I have used https://www.youtube.com/watch?v=-wWOyaJ-PUM, this example to learn. but I don't know how to create 3 Peer connections?
I am also using node socket.io for creating a room. But still don't get it How to use RTCPeerConnection to make 3 peer video chat in Flutter? I already asked on Reddit. But not get a relevant reply. so please give me any relevant steps or code?

You'd need to either
setup peer-to-peer between all the parties (there will be 3 links in total, each party will be sending video twice and be receiving two streams), or
you need an intermediary server

Related

Flutter WebRTC There is no sound in the call

I'm building an application that provides voice conversation with Flutter and WebRTC. When I initiate a call with WebRTC, no sound is sent in a voice call.
I use STUN server for P2P and privacy. A connection is established with the STUN server and I am receiving candidate data. There is no mutual voice conversation only. I know STUN server has problems with ports and firewalls. I am sure my problem is not caused by this.
Before writing here, I thought to issue an issue to the WebRTC repo on GitHub, but unfortunately the repo is quite passive. I could not even get an answer to the issue I opened 2 weeks ago(About sound effects).
I share the dart file with the voice conversation. I would be very happy if you could give an idea. I could not find a solution. Thank you for sparing your precious time.
My code: call_page.dart

How can I connect to WebSocket server in swift?

I heard Apple recently added web sockets which allows a server to push data but i did't get any single example or any documentation.
I want to make a app where i can have the data from a websocket server can anyone help me how can i do that.
May i have to download a third party library?

Flutter + webrtc room video call

Im find https://github.com/cloudwebrtc/flutter-webrtc for use webrtc in flutter. But in repository, the sample is only peer to peer with 2 devices. I have build app for my customer for video call with many people. It's possible use this package for build video conference (2+) in flutter?
Yes, you should be able to establish a video call with many people using WebRTC and this package.
One approach would be to create a new RTCPeerConnection for every new peer in your room.
Check out this example, it does exactly that.
However, since WebRTC is intended for peer-to-peer, this solution is not scalable at all, because you are going to be creating new peer connections exponentially.
With ~6 people, the quality of your call will already be terrible.
If your intention is to have a conference room, you should really look into using a Selective Forwarding Unit (SFU), if you plan to be scalable at all.
Checkout Janus VideoRoom plugin for an open-source SFU implementation, just be aware that it's a bit cumbersome to set it up.
For room video call, or live stream... you have to use a Media server to make it, webrtc just allow 2 peer, need a Media server to be an intermediaries
unfortunately, you cannot use it for 2+ communication, because the main idea of webRTC is connect two sides through P2P.

Peer-to-peer communication between iOS devices

I am trying to prototype a solution to a problem and am currently exploring multiple routes I could try. Is it possible for one iOS device, running a certain app, to communicate directly with another iOS device, running the same application - without the need to be on the same LAN?
Solutions I am currently investigating are using Bluetooth and ad-hoc wireless connections.
Ideally, the application when installed would ask the user for the required permissions, and then would accept and/or send data to/from another client after a handshake had happened.
My concern with Bluetooth is that 'pairing' would need to happen with every device, rather than happen in the background once the user has installed the app. I have a feeling what I am talking about isn't possible from what I've been reading elsewhere on Stackoverflow.
Take a look at Bluetooth Low Energy.
https://developer.apple.com/library/ios/#samplecode/BTLE_Transfer/Introduction/Intro.html#//apple_ref/doc/uid/DTS40012927
Here is another example,
https://github.com/KhaosT/CBPeripheralManager-Demo
You might also want to look into GameKit and peer-to-peer connectivity there.
I can't tell you anything about it, but you might try looking at iOS 7. If that's an option, I'd take a look. Can't talk about what it is because of NDA though.
Depending on what you need to communicate, you could try checking out this project, which lets you share arrays of strings between iOS devices over Bluetooth LE.
You don't need to "pair" the devices and it can still communicate while the app is in the background. SimpleShare
Hope it helps!
From the documentation of MultipeerGroupChat:
MultipeerGroupChat sample application utilizes the Multipeer Connectivity framework to enable nearby users to discover, connected, and send data between each other. This sample simulates a simple chat interface where up to 8 devices can connect with each other and send text messages or images to each other. Here you will learn how to bring up framework UI for discovery and connections and also how to monitor session state, listen for incoming data and resources, and send data and resources.
This is an excellent example at developer.apple.com here is the link
https://developer.apple.com/library/ios/samplecode/MultipeerGroupChat/Introduction/Intro.html
Also this tutorial from Ralf Ebert demonstrates how to use Multipeer Connectivity framework for peer communication should help you.
https://www.ralfebert.de/tutorials/ios-swift-multipeer-connectivity/

Socket connection between rails and iphone native app

I have an iphone app with rails serving as a backend server.
Now I need to implement a chat functionality using sockets connections.
A lot of examples show you how to implement chat using sockets in browser.
What I need here is how I can implement an application where you create socket server in the rails app , and the client in iphone app which listens to the channel I give them.
I tried using faye(examples given only how to implement client in the browser) and using fayeObjC library for iphone to create client, but am not able to listen to the channel from this library.I know I must be implementing it wrong here.
I'll share my code also here, but first I need to know is there a better solution than this?
Also I appreciate some links to some examples where socket server is in rails and clients are iphone app.
Appreciate any help and mostly need a right direction to implement it.
Update
I tried the faye combination again and it worked.Although still looking for more solutions.
You can check about TCP sockets:
http://www.raywenderlich.com/3932/how-to-create-a-socket-based-iphone-app-and-server
Chat Application Using Ruby
http://quickblox.com/modules/chat/
http://caydenliew.com/2011/11/ios-mac-os-communication-with-asyncsocket/
http://www.macresearch.org/cocoa-scientists-part-xxix-message
Next link is a comprehensive Networking Guide - Using Internet Sockets
You must keep in mind two major problems to peer-to-peer communications (Chat): reachability and how to receive new messages while your application is in the background (get notifications).
For the last you can use APNS approach: an invisible notification will be pushed to the iPhone indicating that a new message is ready to be read. So your app will make a request for unread messages (what app like WhatsApp does).
Besides TCP sockets you could use websockets (HTTP - so there are no firewall problems).
Best in class - Socket.IO.
Here you will find the wiki https://github.com/learnboost/socket.io/wiki (you will find there an extension for Ruby also)
Here an example for iOS chat client for socket.io & node.js backend
Jabber
Another option: XMPP - "stands for eXtensible Messaging and Presence Protocol. Such a protocol is open-standard and oriented to message exchange (builds and maintains by Jabber community). Message exchange happens near real time, so it is an ideal infrastructure to build chat-like applications. The protocol also implements a mechanism to notify presence information (whether a user is online or not) and the maintenance of a contact list. XMPP is a thorough protocol, which has been adopted also by big companies like Google to build their Instant Messaging service."
Here you will find all about developing a Jabber Client for iOS (enable users to sign in, add buddies, and send messages; how to install and configure a jabber server, create accounts, and interact with the server from an iOS application http://mobile.tutsplus.com/tutorials/iphone/building-a-jabber-client-for-ios-server-setup/
I know that SocketRocket by square is a strong native Objective-C library. But it doesn't offer the channel abstraction you seem to be looking for.
If you would consider outsourcing the WebSocket connections then you could use a hosted service like Pusher, who I work for. You can publish messages (trigger events) on channels using the pusher-gem. And you can subscribe to channels and receive messages using one of Pusher's Objective-C libraries.
Other solutions will also have Objective-C libraries and you can find a list of them via this realtime web tech guide.