Git Product home page Git Product logo

meething-mediasoup's Introduction

mozilla-builders

Meething MediaSoup

This is the awesome mediasoup multiroom server implementation for meething

Why?

There are many servers like it, but this one provides transparent room and user routing based on wss URL parameters and LRU rooms

wss://meething-mediasoup:2345/?roomId=lobby&peerId=meMyselfandI

dWeb (wip)

The SFU will advertise itself to gun and/or hyperswarm dht peers for discovery by clients

Configuration

Configure your SSL certificates and preferences in meething-mediasoup.config.js

Service

pm2 start meething-mediasoup.config.js

Credits

  • MediaSoup its Authors get all the credit for the SFU magic and their help
  • The Meething team for their enthusiasm and ideas
  • Mozilla Builders program and its mentors for the guidance

meething-mediasoup's People

Contributors

dependabot[bot] avatar lmangani avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

meething-mediasoup's Issues

As soon as the content of the page (Javascript, websocket ..) is deactivated (tab not closed), the events return on return (not good)

To reproduce the bug, you must have for example Firefox and this module: https://addons.mozilla.org/fr/firefox/addon/work-offline-page-only/ in order to simulate the auto-disconnection that there is a on Android and iOS compared to battery or battery economy to reproduce the same thing but on a computer with Firefox.

Here's how to reproduce the bug:

  1. Install https://github.com/meething/meething-mediasoup.git as usual and replace const wsTransport = new WebSocketTransport ('wss: //'+window.location.hostname+': 2345 ');
    by
    const wsTransport = new WebSocketTransport('wss://soupes.xxx.com:443/?roomId=test&peerId='+(new Date).getTime()+'g&t='+(new Date).getTime());
    or done as you want.
  2. Start meething-mediasoup
  3. Open 2 browsers like Firefox and Chrome
  4. You must only use Chrome to send your webcam.
  5. With Firefox, accept the webcam of the Chrome user, you will see this: "Do you consume video from 16222 ..." and accepted.
  6. Now put the Firefox tab in inactive with the work-offline-page-only module, then a few seconds after restarting it, you will automatically receive "Do you consume video from 16222090749 .." and it's not well, normally nothing should happen, it has to be emptied or something, how to not make this appear on reconnection?
    On an Android / iOS this technique in production is very dirty, that's why you would have to remove the consume or the id.

it would take a kind of leave()

request timeout

I installed meething-mediasoup by recovering the meething-mediasoup that was on my old server, I installed everything on the server and client side with "npm i" and the side seems to crash on average every 6h to 12h with this mistake:

_createConsumer() | failed:Error: TypeError: Cannot read properties of null (reading 'consume')
    at Peer._handleResponse (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/Peer.js:282:18)
    at WebSocketTransport.<anonymous> (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/Peer.js:214:10)
    at WebSocketTransport.emit (node:events:390:28)
    at WebSocketTransport.safeEmit (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/EnhancedEventEmitter.js:18:9)
    at WebSocketConnection.<anonymous> (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/transports/WebSocketTransport.js:129:9)
    at WebSocketConnection.emit (node:events:390:28)
    at WebSocketConnection.processFrame (/home/debian/node/mediasoup/meething-mediasoup/node_modules/websocket/lib/WebSocketConnection.js:554:26)
    at /home/debian/node/mediasoup/meething-mediasoup/node_modules/websocket/lib/WebSocketConnection.js:323:40
    at processTicksAndRejections (node:internal/process/task_queues:78:11) {
  [stack]: "Error: TypeError: Cannot read properties of null (reading 'consume')\n" +
    '    at Peer._handleResponse (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/Peer.js:282:18)\n' +
    '    at WebSocketTransport.<anonymous> (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/Peer.js:214:10)\n' +
    '    at WebSocketTransport.emit (node:events:390:28)\n' +
    '    at WebSocketTransport.safeEmit (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/EnhancedEventEmitter.js:18:9)\n' +
    '    at WebSocketConnection.<anonymous> (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/transports/WebSocketTransport.js:129:9)\n' +
    '    at WebSocketConnection.emit (node:events:390:28)\n' +
    '    at WebSocketConnection.processFrame (/home/debian/node/mediasoup/meething-mediasoup/node_modules/websocket/lib/WebSocketConnection.js:554:26)\n' +
    '    at /home/debian/node/mediasoup/meething-mediasoup/node_modules/websocket/lib/WebSocketConnection.js:323:40\n' +
    '    at processTicksAndRejections (node:internal/process/task_queues:78:11)',
  [message]: "TypeError: Cannot read properties of null (reading 'consume')",
  code: 500
}
_createConsumer() | failed:Error: request timeout
    at Timeout._onTimeout (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/Peer.js:156:14)
    at listOnTimeout (node:internal/timers:557:17)
    at processTimers (node:internal/timers:500:7) {
  [stack]: 'Error: request timeout\n' +
    '    at Timeout._onTimeout (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/Peer.js:156:14)\n' +
    '    at listOnTimeout (node:internal/timers:557:17)\n' +
    '    at processTimers (node:internal/timers:500:7)',
  [message]: 'request timeout'
}
request failed:Error: producer with id "e509edbb-5687-4003-94fe-b71eb325edaf" not found
    at ConfRoom._handleProtooRequest (/home/debian/node/mediasoup/meething-mediasoup/lib/Room.js:222:17)
    at Peer.<anonymous> (/home/debian/node/mediasoup/meething-mediasoup/lib/Room.js:58:12)
    at Peer.emit (node:events:390:28)
    at Peer._handleRequest (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/Peer.js:224:9)
    at WebSocketTransport.<anonymous> (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/Peer.js:212:10)
    at WebSocketTransport.emit (node:events:390:28)
    at WebSocketTransport.safeEmit (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/EnhancedEventEmitter.js:18:9)
    at WebSocketConnection.<anonymous> (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/transports/WebSocketTransport.js:129:9)
    at WebSocketConnection.emit (node:events:390:28)
    at WebSocketConnection.processFrame (/home/debian/node/mediasoup/meething-mediasoup/node_modules/websocket/lib/WebSocketConnection.js:554:26) {
  [stack]: 'Error: producer with id "e509edbb-5687-4003-94fe-b71eb325edaf" not found\n' +
    '    at ConfRoom._handleProtooRequest (/home/debian/node/mediasoup/meething-mediasoup/lib/Room.js:222:17)\n' +
    '    at Peer.<anonymous> (/home/debian/node/mediasoup/meething-mediasoup/lib/Room.js:58:12)\n' +
    '    at Peer.emit (node:events:390:28)\n' +
    '    at Peer._handleRequest (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/Peer.js:224:9)\n' +
    '    at WebSocketTransport.<anonymous> (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/Peer.js:212:10)\n' +
    '    at WebSocketTransport.emit (node:events:390:28)\n' +
    '    at WebSocketTransport.safeEmit (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/EnhancedEventEmitter.js:18:9)\n' +
    '    at WebSocketConnection.<anonymous> (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/transports/WebSocketTransport.js:129:9)\n' +
    '    at WebSocketConnection.emit (node:events:390:28)\n' +
    '    at WebSocketConnection.processFrame (/home/debian/node/mediasoup/meething-mediasoup/node_modules/websocket/lib/WebSocketConnection.js:554:26)',
  [message]: 'producer with id "e509edbb-5687-4003-94fe-b71eb325edaf" not found'
}
/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/Peer.js:156
					pReject(new Error('request timeout'));
					        ^

Error: request timeout
    at Timeout._onTimeout (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/Peer.js:156:14)
    at listOnTimeout (node:internal/timers:557:17)
    at processTimers (node:internal/timers:500:7)


it could come from where the problem?

OS: Debian 11 (my old OS: Debian 9)
my package.json:

{
  "name": "meething-mediasoup",
  "version": "1.0.2",
  "description": "",
  "scripts": {
    "start": "nodemon ./main.js ./lib"
  },
  "dependencies": {
    "mediasoup": "^3.7.9",
    "protoo-server": "^4.0.3",
    "quick-lru": "^5.1.0",
    "stun": "^2.1.0"
  },
  "devDependencies": {
    "nodemon": "^1.19.1"
  }
}

How to create a close that closes navigator.mediaDevices and all the peers

Hi
I imported the direct url <script src="https://meeting.site.com/main.1f19ae8e.js"></script> by putting this all at the bottom of a page remotely, and I'm trying to adapt.
Everything works well, the camera is displayed both locally and remotely, but when I close the camera (without reloading the page) and relaunch the camera, there are duplicate peers and they all come back.
To fix this problem, I thought I might have to create a "close () {}" or "part () {}" in Room.js but I don't know what to update inside. Can you tell me how to create a closure of navigator.mediaDevices.getUserMedia that closes all peers?

salutations

Meeting-mediasoup server crashes after a while

Hi

So here I explain:
I migrated to a new dedicated server from Debian 9 to Debian 11, it's all almost blank, I put Nodejs v16.13.1 and npm 8.2.0 and I put Meeting-mediasoup like on my old server.

When I start my webcam and I look at myself in another place, I found that it works well but the camera of the transmitter stops the stream at some point, and it restarts randomly a few seconds later. It seems that this bug occurs as soon as a log poster appears indicating "protoo server ... close" here the screen I am looking at on my recipient stops.
This is the first problem!

The second problem is that after a while, maybe 4 or 6 hours, the server will end up crashing on its own, it should be restarted. The server reports the following error (last error recovered) :

/home/debian/node/mediasoup/meething-mediasoup/node_modules/mediasoup/lib/Channel.js:199
                        sent.reject(new Error(msg.reason));
                                    ^

Error: Consumer not found
    at Channel._processMessage (/home/debian/node/mediasoup/meething-mediasoup/node_modules/mediasoup/lib/Channel.js:199:37)
    at Socket.<anonymous> (/home/debian/node/mediasoup/meething-mediasoup/node_modules/mediasoup/lib/Channel.js:61:34)
    at Socket.emit (node:events:390:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at Pipe.onStreamRead (node:internal/stream_base_commons:199:23)

here is the stopping that starts during the webcam session and then restarts then stops and restarts again.. :

protoo Peer "close" event [peerId:Lyredev]
protoo connection request [peerId:51.2xx.xx.1xx, address:/?roomId=d8yn94xv25qh1qfc4lc&peerId=Lyredev&t=1642594542713, room:%s]
existing room stat d8yn94xv25qh1qfc4lc Lyredev {
  peer: 2,
  transport: 2,
  transports: [ { producer: 1 }, { consumer: 0 } ]
}
request:getRouterRtpCapabilities
request:createWebRtcTransport
request:createWebRtcTransport
request:join
request:connectWebRtcTransport

I tried to update several "npm i <name>@<version>" but it's the same, there's still the error.
I also tried to update mediasoup server to the latest version, and there the Meeting-mediasoup server absolutely does not want to start, there are errors.

The problem does not seem to come from ipv6 or not only because of that

Is it possible to give you a tip (less than 120€) to make it functional on a Debian 11 with nodejs latest version and possibly the latest version of mediasoup?

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.