GithubHelp home page GithubHelp logo

peer-js-simple-av-example's Introduction

peer-js-simple-av-example

WIP -

  • peer js server + express
  • with apache ssl config
  • various client side examples in /public

Apache SSL config

Follow letsencrypt to get a generated ssl apache config file

sudo a2ensite example.conf
sudo a2enmod rewrite proxy proxy_balancer proxy_wstunnel proxy_http
sudo service apache2 reload
sudo service apache2 restart

Add certs

sudo apt install certbot
sudo apt install python3-certbot-apache

open server ports

https: tcp: 443

webrtc tcp: 554, 1935, 8080-8084, 8443-8445, 8888, 9091, 30000-33000

webrtc udp: 1935, 30000-33000

get the cert

sudo certbot --apache -d myserver.example.com --post-hook "/usr/sbin/service apache2 restart"

then edit to match example in this dir: example-le-ssl.conf and restart apache.

idea is to proxy ssl to 8443 node server below, including wss

setup peer.js server with express

as per: https://github.com/peers/peerjs-server

check out this repo

npm install peer
sudo node server.js

(sudo becuase of access to the ssl certs)

and go to https://myserver.example.com/test.html

Weirdnesses

I only really found 1 eith asymmetric - video one way and audio the other

multiplayer

Peer.js can do multiple peers, but you need to make pair by pair calls for each. I think (reference: https://stackoverflow.com/questions/62743121/multi-party-video-conference-with-peerjs).

There's an example in public/room-audio-multipeer-with-presence

stun / turn server

You don't always need these but it's easy to install one:

sudo apt-get -y install coturn

sudo nano /etc/turnserver.conf

contents

realm=coturn.myserver.example.com
fingerprint
listening-ip=0.0.0.0
external-ip=<EXTERNAL_IP>/<INTERNAL_IP> #or just the external ip
listening-port=3478
min-port=10000
max-port=20000
log-file=/var/log/turnserver.log
verbose
user=something:something
lt-cred-mech

sudo nano /etc/default/coturn

TURNSERVER_ENABLED=1

OPEN PORT tcp:3478 (and udp?)

check:

netstat -pnltu | grep 3478

and setup for peer.js is

var peer = new Peer(
{
  key: 'peerjs', host: 'myserver.example.com', path: "/",debug:3, port: 443, secure: true,
  config: {'iceServers': [
   { url: 'turn:myserver.example.com:3478?transport=udp', username: 'something', credential: 'something' },
   { url: 'turn:myserver.example.com:3478?transport=tcp', username: 'something', credential: 'something' }
  ]}
});

peer-js-simple-av-example's People

Contributors

libbymiller avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.