https://github.com/security-union/ion-webrtc-demo
Flutter webrtc demo using ion
https://github.com/security-union/ion-webrtc-demo
Last synced: 11 months ago
JSON representation
Flutter webrtc demo using ion
- Host: GitHub
- URL: https://github.com/security-union/ion-webrtc-demo
- Owner: security-union
- Created: 2021-06-30T22:35:21.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-07-21T22:13:02.000Z (almost 5 years ago)
- Last Synced: 2025-02-16T23:02:15.262Z (over 1 year ago)
- Language: Dart
- Size: 207 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Ion WebRTC Demo
This demo is a N to 1 per session webRTC call implementation with ion.
First, execute the ion SFU server on your computer:
```sh
docker run -p 9090:50051 -p 5000-5200:5000-5200/udp pionwebrtc/ion-sfu:latest-grpc
```
Then, modify the *getUrl* method inside lib/src/views/home.dart
and set the ```ion.GRPCWebSignal('http://192.168.1.46:9090')``` with your local ip so phones can connect to your local sfu server
### Development
Ion lets you create & join sessions on a SFU server to share your video/audio in real time with other users on that session.
You just have to create a Client object specifying the SFU server, the session & your unique identifier.
Then, if you want to start sending video its as easy as just calling ```client.publish(mediaStream)```
More about SFU: https://webrtcglossary.com/sfu
The cool thing about SFU and ion is that you dont need to care about signaling peer to peer but just signaling with the SFU server (which is done automatically by the library).
The server will start sending you the streaming data (video/audio) of the other peers on that session as soon as you connect to it.
Example:
```dart
final signal = await ion.GRPCWebSignal('');
client = await ion.Client.create(
sid: sid, // Session id
uid: uid, // Send our UUID so the server knows who we are
signal: _signal, // Signaling object pointing to the SFU server
);
// You are already connected to the server and ready to receive data lol
client.ontrack = (track, ion.RemoteStream remoteStream) async {
if (track.kind == 'video') {
// Now we can store the remote stream and create a RTCVideoRenderer with it
}
};
// Lets publish our video
final localStream = await ion.LocalStream.getUserMedia(
constraints: ion.Constraints.defaults..simulcast = false,
);
await client.publish(_localStream);
```
To setup the QR code scanner in iOs follow the instructions described [here](https://pub.dev/packages/flutter_barcode_scanner)