Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
const EventEmitter = require('events');
const mediasoup = require('mediasoup');
const RTCPeerConnection = mediasoup.webrtc.RTCPeerConnection;
class WebRtcConnection extends EventEmitter {
constructor(server, socket){
super();
this.server = server;
this.socket = socket;
this.peerConnection = null;
this.id = socket.id;
this.sdp = null;
this.roomId = null;
this.mediaPeer = null;
// socket.io
socket.on('disconnect', () => {
const url = require('url');
const udid = require('udid');
const util = require('util');
const path = require('path');
const rtsp = require('rtsp-stream');
const dgram = require('dgram');
const https = require('https');
const express = require('express');
const Promise = require('bluebird');
const socketIO = require('socket.io');
const child_process = require('child_process');
const sdp_transform = require('sdp-transform');
const mediasoup = require('mediasoup');
const RTCPeerConnection = mediasoup.webrtc.RTCPeerConnection;
const RTCSessionDescription = mediasoup.webrtc.RTCSessionDescription;
const roomOptions = require('./data/options').roomOptions;
const peerCapabilities = require('./data/options').peerCapabilities;
const OutputTypes = {
RTMP: 1,
MKV: 2,
MP4: 3
};
class Room {
constructor(mediaServer, name){
const d = new Date();
this.id = udid('y' + name + d.getTime());
this.name = name;
this.mediaServer = mediaServer;
const net = require('net');
const url = require('url');
const udid = require('udid');
const util = require('util');
const path = require('path');
const rtsp = require('rtsp-stream');
const dgram = require('dgram');
const https = require('https');
const express = require('express');
const Promise = require('bluebird');
const socketIO = require('socket.io');
const child_process = require('child_process');
const sdp_transform = require('sdp-transform');
const mediasoup = require('mediasoup');
const RTCPeerConnection = mediasoup.webrtc.RTCPeerConnection;
const RTCSessionDescription = mediasoup.webrtc.RTCSessionDescription;
const roomOptions = require('./data/options').roomOptions;
const peerCapabilities = require('./data/options').peerCapabilities;
const OutputTypes = {
RTMP: 1,
MKV: 2,
MP4: 3
};
class Room {
constructor(mediaServer, name){
const d = new Date();
this.id = udid('y' + name + d.getTime());
this.name = name;