Code Monkey home page Code Monkey logo

mediasoup-sfu-webrtc-video-rooms's Introduction

Mediasoup video conferencing

Example website for multi-party video/audio/screen conferencing using mediasoup. This project is intended to better understand how mediasoup works with a simple example.

This project is featured on the mediasoup examples page with many other examples. Checkout mediasoup at mediasoup.org

Running the code

  • run npm install then npm start to run the application. Then open your browser at https://localhost:3016 or your own defined port/url in the config file.
  • (optional) edit the src/config.js file according to your needs and replace the ssl/key.pem ssl/cert.pem certificates with your own.

Deployment

  • in config.js replace the announcedIP with your public ip address of the server and modify the port you want to serve it in.
  • add firewall rules of the port of the webpage (default 3016) and the rtc connections (default udp 10000-10100) for the machine.

Pull Requests

  • Please run npx prettier --write . before to make a PR.

notes : Best to run the project on a linux system as the mediasoup installation could have issues by installing on windows. If you have a windows system consider installing WSL to be able to run it.

installing wsl on windows 10

mediasoup-sfu-webrtc-video-rooms's People

Contributors

dirvann avatar miroslavpejic85 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

mediasoup-sfu-webrtc-video-rooms's Issues

There are sometimes people who want to put on their webcam but the interlocutor does not receive

Hi
Sometimes there are people who want to put their webcam on but the interlocutor can't see, I don't know where the problem comes from.

Here is an example:

  • The transmitter turns on his webcam, or he succeeds (but his sends black flow on the screen), I don't know exactly how it is displayed at home, I don't know if he sees himself on a webcam.
  • The transmitter turns on his webcam, or he does not succeed (there is something blocking, I don't know what it is)

On the other hand, I wonder about the turn/stun, could there be a blockage with some firewalls among users or on the dedicated server?

Salutations

Fix 4 enumerateDevices

Hi @Dirvann, nice to meet you &
Thanks for this useful project! ;)

Small fix for enumerateDevices

https://github.com/Dirvann/mediasoup-sfu-webrtc-video-rooms/blob/master/public/index.js#L95

function joinRoom(name, room_id) {
    if (rc && rc.isOpen()) {
        console.log('already connected to a room');
    } else {
        rc = new RoomClient(
            localMedia,
            remoteVideos,
            remoteAudios,
            window.mediasoupClient,
            socket,
            room_id,
            name,
            roomOpen,
        );

        addListeners();
        initEnumerateDevices(); // --->  call it from here when join in the room
    }
}

function initEnumerateDevices() {
   // Many browsers, without the consent of getUserMedia, cannot enumerate the devices. 

    const constraints = {
        audio: true,
        video: true,
    };

    navigator.mediaDevices
    .getUserMedia(constraints)
    .then(() => {
        enumerateDevices();
    })
    .catch((err) => {
        console.error('Access denied for audio/video: ', err);
    });
}

function enumerateDevices() {
    // Load mediaDevice options
    navigator.mediaDevices.enumerateDevices().then((devices) =>
        devices.forEach((device) => {
            let el = null;
            if ('audioinput' === device.kind) {
                el = audioSelect;
            } else if ('videoinput' === device.kind) {
                el = videoSelect;
            }
            if (!el) return;

            let option = document.createElement('option');
            option.value = device.deviceId;
            option.innerText = device.label;
            el.appendChild(option);
        }),
    );
}

In order to pass correctly, the deviceId to the produce instead of empty ;)
https://github.com/Dirvann/mediasoup-sfu-webrtc-video-rooms/blob/master/public/RoomClient.js#L250

Safari on iPhone and MacOS cannot read the webcam but can send it.

Hi

For about 15 days it has been in production on my site for the people.
I just noticed that it did not work in reception to Safari on an iPhone8. It sends the webcam fine and Safari/Chrome/Firefox can read. But when Firefox sends the camera, Safari on Iphone does not receive.
Where could the problem come from?

cordially

issue when a person leaves the room?

Hi Dirvann!

I was just testing around, nice implementation!

It looks like all consumers are freezing at the same time when a person joins or leaves the room. It's especially clear where there are 3+ people connected. You'll not see/notice it with two people. Do you know why it might be the case?

Might be??

I noticed at the end of line 460 of RoomClient.js the random seeming comment of // might be

I'm curious of what this might mean.

Thank you

Error: ENOENT: no such file or directory, open '/ssl/key.pem'

internal/fs/utils.js:230
throw err;
^

Error: ENOENT: no such file or directory, open '/ssl/key.pem'
at Object.openSync (fs.js:461:3)
at Object.readFileSync (fs.js:363:35)
at Object. (/home/shahnawaz/Downloads/mediasoup-sfu-webrtc-video-rooms-master/src/app.js:13:13)
at Module._compile (internal/modules/cjs/loader.js:1151:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
errno: -2,
syscall: 'open',
code: 'ENOENT',
path: '/ssl/key.pem'
}
[nodemon] app crashed - waiting for file changes before starting...

I am getting this error.
I am attaching the screenshot of project structure
Screenshot from 2020-08-04 14-26-44
Screenshot from 2020-08-04 14-29-06

. Kindly check it.

consumer setPreferredLayers

Peer.js -> createConsumer

  if (consumer.type === 'simulcast') {
    await consumer.setPreferredLayers({
      spatialLayer: 2,
      temporalLayer: 2
    })
  }

why call 'setPreferredLayers' ? This is not done in the official demo

"broadCast" in class "Room" not working

I have tried to run the code in a separate project.
When the sockets join the same room with different names, and one of them started their audio, then the other sockets wouldn't receive the broadCast 'newProducers' in Room.js.

I have checked the Map (Room.js line 89 when it emits 'newProducers'), and it does contain the socket.id's, and it emits to the correct socket.id, but the event wouldn't fire on the client-side. The 'initSockets()' function is properly executed, so the event should be listening, any ideas why the emit wouldn't arrive?

Resulting, if someone started audio the others wouldn't be able to hear that person unless they joined the Room while the person had audio already started (since the app.js has a socket.emit('newProducers', producerList) which is executed on room join). The same problem occurs with video/screen sharing obviously, the sockets would only see the person's video if they joined while the stream was already turned on, and not turned on while they were already in the room.

I haven't changed the code apart from having my own https express server and passing the 'socket' and 'io' into a function containing the .on('connection') events (which shouldn't affect the code). In my config file I only changed the 'announcedIp' to my local IP.

All client and server logs seem normal apart from the 'new Producers' missing, in RoomClient.js line 229.

A conflict with the enumerateDevices if you have several camera devices

Hi

alt text

On Chrome I have several cameras, the Avermedia is a video card that broadcasts DTT channels on a computer instead of television.
There's Manycam, that's my test webcam device.
I have another camera, it's not plugged in, it's a real webcam.

I noticed that the Avermedia is always first, therefore it very often selects the Avermedia by default.

Here's how the conflict unfolds:

  1. I turn on my camera (it selects the Manycam well)
  2. If I want to turn the camera back on, this time it still selects Avermedia, but I would like it to select Manycam

As a result, customers cannot turn on their webcam if they have multiple devices

Do you have an idea to solve this?

Salutations

Application that crashes after 7-10 days, it's done it twice

Here is the pm2 log:

Consume failed TypeError: Cannot read properties of undefined (reading 'consume')
    at Peer.createConsumer (/home/debian/node/appname/mediasoup/src/Peer.js:48:42)
    at Room.consume (/home/debian/node/appname/mediasoup/src/Room.js:118:8)
    at Socket.<anonymous> (/home/debian/node/appname/mediasoup/src/app.js:190:53)
    at Socket.emit (node:events:526:28)
    at Socket.emitUntyped (/home/debian/node/appname/mediasoup/node_modules/socket.io/dist/typed-events.js:69:22)
    at /home/debian/node/appname/mediasoup/node_modules/socket.io/dist/socket.js:466:39
    at processTicksAndRejections (node:internal/process/task_queues:78:11)
TypeError: Cannot destructure property 'consumer' of '(intermediate value)' as it is undefined.
    at Room.consume (/home/debian/node/appname/mediasoup/src/Room.js:116:11)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Socket.<anonymous> (/home/debian/node/appname/mediasoup/src/app.js:190:18)
Consume failed TypeError: Cannot read properties of undefined (reading 'consume')
    at Peer.createConsumer (/home/debian/node/appname/mediasoup/src/Peer.js:48:42)
    at Room.consume (/home/debian/node/appname/mediasoup/src/Room.js:118:8)
    at Socket.<anonymous> (/home/debian/node/appname/mediasoup/src/app.js:190:53)
    at Socket.emit (node:events:526:28)
    at Socket.emitUntyped (/home/debian/node/appname/mediasoup/node_modules/socket.io/dist/typed-events.js:69:22)
    at /home/debian/node/appname/mediasoup/node_modules/socket.io/dist/socket.js:466:39
    at processTicksAndRejections (node:internal/process/task_queues:78:11)
TypeError: Cannot destructure property 'consumer' of '(intermediate value)' as it is undefined.
    at Room.consume (/home/debian/node/appname/mediasoup/src/Room.js:116:11)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Socket.<anonymous> (/home/debian/node/appname/mediasoup/src/app.js:190:18)
Consume failed TypeError: Cannot read properties of undefined (reading 'consume')
    at Peer.createConsumer (/home/debian/node/appname/mediasoup/src/Peer.js:48:42)
    at Room.consume (/home/debian/node/appname/mediasoup/src/Room.js:118:8)
    at Socket.<anonymous> (/home/debian/node/appname/mediasoup/src/app.js:190:53)
    at Socket.emit (node:events:526:28)
    at Socket.emitUntyped (/home/debian/node/appname/mediasoup/node_modules/socket.io/dist/typed-events.js:69:22)
    at /home/debian/node/appname/mediasoup/node_modules/socket.io/dist/socket.js:466:39
    at processTicksAndRejections (node:internal/process/task_queues:78:11)
TypeError: Cannot destructure property 'consumer' of '(intermediate value)' as it is undefined.
    at Room.consume (/home/debian/node/appname/mediasoup/src/Room.js:116:11)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Socket.<anonymous> (/home/debian/node/appname/mediasoup/src/app.js:190:18)
can not consume
TypeError: Cannot read properties of undefined (reading 'id')
    at Socket.<anonymous> (/home/debian/node/appname/mediasoup/src/app.js:195:30)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
TypeError: Cannot read properties of undefined (reading 'produce')
    at Peer.createProducer (/home/debian/node/appname/mediasoup/src/Peer.js:24:66)
    at Room.<anonymous> (/home/debian/node/appname/mediasoup/src/Room.js:92:56)
    at new Promise (<anonymous>)
    at Room.produce (/home/debian/node/appname/mediasoup/src/Room.js:90:12)
    at Socket.<anonymous> (/home/debian/node/appname/mediasoup/src/app.js:175:58)
    at Socket.emit (node:events:526:28)
    at Socket.emitUntyped (/home/debian/node/appname/mediasoup/node_modules/socket.io/dist/typed-events.js:69:22)
    at /home/debian/node/appname/mediasoup/node_modules/socket.io/dist/socket.js:466:39
    at processTicksAndRejections (node:internal/process/task_queues:78:11)
TypeError: Cannot read properties of undefined (reading 'close')
    at Peer.closeProducer (/home/debian/node/appname/mediasoup/src/Peer.js:90:38)
    at Room.closeProducer (/home/debian/node/appname/mediasoup/src/Room.js:144:31)
    at Socket.<anonymous> (/home/debian/node/appname/mediasoup/src/app.js:224:34)
    at Socket.emit (node:events:526:28)
    at Socket.emitUntyped (/home/debian/node/appname/mediasoup/node_modules/socket.io/dist/typed-events.js:69:22)
    at /home/debian/node/appname/mediasoup/node_modules/socket.io/dist/socket.js:466:39
    at processTicksAndRejections (node:internal/process/task_queues:78:11)
TypeError: Cannot read properties of undefined (reading 'produce')
    at Peer.createProducer (/home/debian/node/appname/mediasoup/src/Peer.js:24:66)
    at Room.<anonymous> (/home/debian/node/appname/mediasoup/src/Room.js:92:56)
    at new Promise (<anonymous>)
    at Room.produce (/home/debian/node/appname/mediasoup/src/Room.js:90:12)
    at Socket.<anonymous> (/home/debian/node/appname/mediasoup/src/app.js:175:58)
    at Socket.emit (node:events:526:28)
    at Socket.emitUntyped (/home/debian/node/appname/mediasoup/node_modules/socket.io/dist/typed-events.js:69:22)
    at /home/debian/node/appname/mediasoup/node_modules/socket.io/dist/socket.js:466:39
    at processTicksAndRejections (node:internal/process/task_queues:78:11)
Consume failed TypeError: Cannot read properties of undefined (reading 'consume')
    at Peer.createConsumer (/home/debian/node/appname/mediasoup/src/Peer.js:48:42)
    at Room.consume (/home/debian/node/appname/mediasoup/src/Room.js:118:8)
    at Socket.<anonymous> (/home/debian/node/appname/mediasoup/src/app.js:190:53)
    at Socket.emit (node:events:526:28)
    at Socket.emitUntyped (/home/debian/node/appname/mediasoup/node_modules/socket.io/dist/typed-events.js:69:22)
    at /home/debian/node/appname/mediasoup/node_modules/socket.io/dist/socket.js:466:39
    at processTicksAndRejections (node:internal/process/task_queues:78:11)
TypeError: Cannot destructure property 'consumer' of '(intermediate value)' as it is undefined.
    at Room.consume (/home/debian/node/appname/mediasoup/src/Room.js:116:11)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Socket.<anonymous> (/home/debian/node/appname/mediasoup/src/app.js:190:18)
Consume failed TypeError: Cannot read properties of undefined (reading 'consume')
    at Peer.createConsumer (/home/debian/node/appname/mediasoup/src/Peer.js:48:42)
    at Room.consume (/home/debian/node/appname/mediasoup/src/Room.js:118:8)
    at Socket.<anonymous> (/home/debian/node/appname/mediasoup/src/app.js:190:53)
    at Socket.emit (node:events:526:28)
    at Socket.emitUntyped (/home/debian/node/appname/mediasoup/node_modules/socket.io/dist/typed-events.js:69:22)
    at /home/debian/node/appname/mediasoup/node_modules/socket.io/dist/socket.js:466:39
    at processTicksAndRejections (node:internal/process/task_queues:78:11)
TypeError: Cannot destructure property 'consumer' of '(intermediate value)' as it is undefined.
    at Room.consume (/home/debian/node/appname/mediasoup/src/Room.js:116:11)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Socket.<anonymous> (/home/debian/node/appname/mediasoup/src/app.js:190:18)
can not consume
TypeError: Cannot read properties of undefined (reading 'id')
    at Socket.<anonymous> (/home/debian/node/appname/mediasoup/src/app.js:195:30)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
can not consume
TypeError: Cannot read properties of undefined (reading 'id')
    at Socket.<anonymous> (/home/debian/node/appname/mediasoup/src/app.js:195:30)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
TypeError: Cannot read properties of undefined (reading 'close')
    at Peer.closeProducer (/home/debian/node/appname/mediasoup/src/Peer.js:90:38)
    at Room.closeProducer (/home/debian/node/appname/mediasoup/src/Room.js:144:31)
    at Socket.<anonymous> (/home/debian/node/appname/mediasoup/src/app.js:224:34)
    at Socket.emit (node:events:526:28)
    at Socket.emitUntyped (/home/debian/node/appname/mediasoup/node_modules/socket.io/dist/typed-events.js:69:22)
    at /home/debian/node/appname/mediasoup/node_modules/socket.io/dist/socket.js:466:39
    at processTicksAndRejections (node:internal/process/task_queues:78:11)
Consume failed TypeError: Cannot read properties of undefined (reading 'consume')
    at Peer.createConsumer (/home/debian/node/appname/mediasoup/src/Peer.js:48:42)
    at Room.consume (/home/debian/node/appname/mediasoup/src/Room.js:118:8)
    at Socket.<anonymous> (/home/debian/node/appname/mediasoup/src/app.js:190:53)
    at Socket.emit (node:events:526:28)
    at Socket.emitUntyped (/home/debian/node/appname/mediasoup/node_modules/socket.io/dist/typed-events.js:69:22)
    at /home/debian/node/appname/mediasoup/node_modules/socket.io/dist/socket.js:466:39
    at processTicksAndRejections (node:internal/process/task_queues:78:11)
TypeError: Cannot destructure property 'consumer' of '(intermediate value)' as it is undefined.
    at Room.consume (/home/debian/node/appname/mediasoup/src/Room.js:116:11)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Socket.<anonymous> (/home/debian/node/appname/mediasoup/src/app.js:190:18)
TypeError: Cannot read properties of undefined (reading 'produce')
    at Peer.createProducer (/home/debian/node/appname/mediasoup/src/Peer.js:24:66)
    at Room.<anonymous> (/home/debian/node/appname/mediasoup/src/Room.js:92:56)
    at new Promise (<anonymous>)
    at Room.produce (/home/debian/node/appname/mediasoup/src/Room.js:90:12)
    at Socket.<anonymous> (/home/debian/node/appname/mediasoup/src/app.js:175:58)
    at Socket.emit (node:events:526:28)
    at Socket.emitUntyped (/home/debian/node/appname/mediasoup/node_modules/socket.io/dist/typed-events.js:69:22)
    at /home/debian/node/appname/mediasoup/node_modules/socket.io/dist/socket.js:466:39
    at processTicksAndRejections (node:internal/process/task_queues:78:11)
Error: no more available ports [transport:udp, ip:'51.255.xx.xx', numAttempt:10000] [method:router.createWebRtcTransport]
    at Channel.processMessage (/home/debian/node/appname/mediasoup/node_modules/mediasoup/node/lib/Channel.js:195:37)
    at Socket.<anonymous> (/home/debian/node/appname/mediasoup/node_modules/mediasoup/node/lib/Channel.js:69:34)
    at Socket.emit (node:events:526: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:190:23)
Error: no more available ports [transport:udp, ip:'51.255.xxxx', numAttempt:10000] [method:router.createWebRtcTransport]
    at Channel.processMessage (/home/debian/node/appname/mediasoup/node_modules/mediasoup/node/lib/Channel.js:195:37)
    at Socket.<anonymous> (/home/debian/node/appname/mediasoup/node_modules/mediasoup/node/lib/Channel.js:69:34)
    at Socket.emit (node:events:526: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:190:23)
Error: no more available ports [transport:udp, ip:'51.255.xx.xx', numAttempt:10000] [method:router.createWebRtcTransport]
    at Channel.processMessage (/home/debian/node/appname/mediasoup/node_modules/mediasoup/node/lib/Channel.js:195:37)
    at Socket.<anonymous> (/home/debian/node/appname/mediasoup/node_modules/mediasoup/node/lib/Channel.js:69:34)
    at Socket.emit (node:events:526: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:190:23)

The log file is very large, but it still has the same identical errors

Where could the problem come from?

Here are the versions of my packages:

   "dependencies": {
     "express": "^4.17.1",
     "httppolyglot": "^0.1.2",
     "mediasoup": "^3.8.2",
     "mediasoup-client": "^3.6.37",
     "socket.io": "^4.1.3"
   }

cordially

Mediasoup is not working in WKWebViewRTC

Hey, I want to implement the video call in a webview for iOS. But the problem is that the device and the browser is not supported. What can I do to create a supported device?

node server crash caused by unprotected console.log in app.js

In src/app.js multiple console.log are logging variables which might not be available.
This causes node to crash.

e.g:

 socket.on('getProducers', () => {
        console.log(---get producers--- name:${roomList.get(socket.room_id).getPeers().get(socket.id).name})
        // send all the current producer to newly joined member
        if (!roomList.has(socket.room_id)) return
        let producerList = roomList.get(socket.room_id).getProducerListForPeer(socket.id)
        socket.emit('newProducers', producerList)
    })

if (!roomList.has(socket.room_id)) getPeers fails and the server crashes.

By putting all the console.log into a try/catch section or after the check avoids that.

socket.on('getProducers', () => {
         // send all the current producer to newly joined member
        if (!roomList.has(socket.room_id)) return ;
        console.log(---get producers--- name:${roomList.get(socket.room_id).getPeers().get(socket.id).name});
        let producerList = roomList.get(socket.room_id).getProducerListForPeer(socket.id);
        socket.emit('newProducers', producerList);
    })

I had the problem with node crashing because of one of the console.log
don't know why exactly it occurred.
Just fixed the console.logs and problem didnt appear again.

No remote audio/video, or screen record seen in remote section

I was experimenting with the project to learn how mediasoup works. Found that, No remote source found in remote section. I have already installed all the packages and updated config.js file's mediasoup.webRtcTransport.listenIps[0].annonuncedIp to my local IP. The local section is working fine but the problem is it won't display the remote section.

invalid RtpParameters

fails on chrome 116
work fine on firefox

 params.encodings = [
          {
            rid: 'r0',
            maxBitrate: 100000,
            //scaleResolutionDownBy: 10.0,
            scalabilityMode: 'S1T3'
          },
          {
            rid: 'r1',
            maxBitrate: 300000,
            scalabilityMode: 'S1T3'
          },
          {
            rid: 'r2',
            maxBitrate: 900000,
            scalabilityMode: 'S1T3'
          }
        ]
        params.codecOptions = {
          videoGoogleStartBitrate: 1000
        }

the js file origin

I want to konw.
mediasoup-client-compile.js mediasoupclient.min.js EventEmitter.min.js
Did you write them yourself, or did you get it from somewhere.
thanks

How to do RTP forwarding?

Hello,

I have been using Janus previously to relay video to a UDP port on the server where Janus is hosted, in a similar way I have to relay video onto the server where mediasoup is hosted.

I there a way to do the RTP forwarding via the example you provided?

Thank you.

An error is caused and in 2 js files there is a note marked "TODO handle null errors",

An error is caused and in 2 js files there is a note marked "TODO handle null errors" and this error occurs.

First here is the error when I launch for example my microphone or camera:

/home/debian/node/dcs/mediasoup/src/Peer.js:24
    let producer = await this.transports.get(producerTransportId).produce({
                                                                 ^

TypeError: Cannot read properties of undefined (reading 'produce')
    at Peer.createProducer (/home/debian/node/dcs/mediasoup/src/Peer.js:24:66)
    at Room.<anonymous> (/home/debian/node/dcs/mediasoup/src/Room.js:92:56)
    at new Promise (<anonymous>)
    at Room.produce (/home/debian/node/dcs/mediasoup/src/Room.js:90:12)
    at Socket.<anonymous> (/home/debian/node/dcs/mediasoup/src/app.js:175:58)
    at Socket.emit (node:events:513:28)
    at Socket.emitUntyped (/home/debian/node/dcs/mediasoup/node_modules/socket.io/dist/typed-events.js:69:22)
    at /home/debian/node/dcs/mediasoup/node_modules/socket.io/dist/socket.js:614:39
    at process.processTicksAndRejections (node:internal/process/task_queues:77:11)

Node.js v18.12.1

I think the error occurs with the 2 comments there are here whose note is "TODO":

Does anyone have an idea how to fix/make them?

No consumer

socket.on("resume", async (data, callback) => {
   await consumer.resume();
   callback();
  });
 ```

Error: ```Cannot find name 'consumer'.ts(2304)```


I have fork this project(i am writing project using typescript),but there is no consumer

[AUTO-FIXED]Firefox 87 Ubuntu 20.04: SSL and WebRTC: ICE failed, add a STUN server. Chromium doesn't see remote

Hello,
Thank you for sharing this project.
I had an error with cert and key, I fixed it by generating stronger keys: openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout ./key.pem -out ./cert.pem

Now, on Firefox, it opens the camera on local then stops it after 5sec and in the console I get:
WebRTC: ICE failed, add a STUN server and see about:webrtc for more details
about:webrtc is just about other webretc servers I used and localhost that failed.

On Chromium, video stays but it's only local on both clients, no remote show up. Whatever I share.
Any idea?

App crashes when connecting/disconnecting?

I was trying to run this app. Sometimes the rooms peers connect and disconnect fine. But sometimes the app crashes.
Here is the console.log when the app crashes:
/home/ec2-user/www/node_modules/mediasoup/lib/Channel.js:199
sent.reject(new Error(msg.reason));
^

Error: [method:transport.connect]
at Channel._processMessage (/home/ec2-user/www/node_modules/mediasoup/lib/Channel.js:199:37)
at Socket. (/home/ec2-user/www/node_modules/mediasoup/lib/Channel.js:61:34)
at Socket.emit (node:events:365:28)
at addChunk (node:internal/streams/readable:314: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:190:23)
[nodemon] app crashed - waiting for file changes before starting...

I have tried to reproduce the error, but it happens randomly. Any suggestions?

No remote stream in chrome/firefox

I have followed the readme and update announcedIp with my AWS static IP. I opened all the required ports. But still this not resolved a problem. Is anyone deployed into AWS this project ?

Thanks in advance.

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.