Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/danielefongo/hallo-client
Simple multi-peer webrtc client
https://github.com/danielefongo/hallo-client
multi-peer simple webrtc
Last synced: 7 days ago
JSON representation
Simple multi-peer webrtc client
- Host: GitHub
- URL: https://github.com/danielefongo/hallo-client
- Owner: danielefongo
- License: mit
- Created: 2020-12-23T11:05:31.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-01-02T11:17:34.000Z (almost 4 years ago)
- Last Synced: 2024-11-01T15:05:12.075Z (14 days ago)
- Topics: multi-peer, simple, webrtc
- Language: JavaScript
- Homepage:
- Size: 43 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# hallo client
Simple webrtc client for [hallo-server](https://www.npmjs.com/package/hallo-server).
## usage
```javascript
const iceServers = {
iceServers: [{ urls: 'stun:stun.l.google.com:19302'}]
}const showWebcam = () => navigator.mediaDevices.getUserMedia({ audio: false, video: true })
const showMonitor = () => navigator.mediaDevices.getDisplayMedia({ video: {displaySurface: "monitor"} })// Create new client
const hallo = new HalloClient(iceServers)// Prepare event handlers
hallo.on('joined', ({username, room, id}) => doStuff())
hallo.on('left', ({username, room, id}) => doStuff())
hallo.on('already_joined', ({username, room, id}) => doStuff())hallo.on('add_remote_track', ({username, track}) => doStuff())
hallo.on('remove_remote_track', ({username, track}) => doStuff())hallo.on('add_local_track', ({username, track}) => doStuff())
hallo.on('remove_local_track', ({username, track}) => doStuff())hallo.on('message', (message) => doStuff())
// Join room
hallo.join("username", "a_room", showWebcam)// Send message
hallo.send("another_username", {message: "hallo!"})// Update stream by using new UserMedia
hallo.changeMediaLambda(showMonitor)// Leave room
hallo.leave()
```