How to use the mediasoup.Server function in mediasoup

To help you get started, we’ve selected a few mediasoup examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github footniko / mediasoup-sample / server / index.js View on Github external
const app = require('http').createServer();
const io = require('socket.io')(app);
const config = require('./config');
const mediasoup = require('mediasoup');
const port = config.server.port;

// Map of Room instances indexed by roomId.
const rooms = new Map();

app.listen(port, () => console.log(`MediaSoup server is listening on port ${port}!`));

// MediaSoup server
const mediaServer = mediasoup.Server({
  numWorkers: null, // Use as many CPUs as available.
  logLevel: config.mediasoup.logLevel,
  logTags: config.mediasoup.logTags,
  rtcIPv4: config.mediasoup.rtcIPv4,
  rtcIPv6: config.mediasoup.rtcIPv6,
  rtcAnnouncedIPv4: config.mediasoup.rtcAnnouncedIPv4,
  rtcAnnouncedIPv6: config.mediasoup.rtcAnnouncedIPv6,
  rtcMinPort: config.mediasoup.rtcMinPort,
  rtcMaxPort: config.mediasoup.rtcMaxPort
});

// Handle socket connection and its messages
io.on('connection', (socket) => {
  console.log('New socket connection:', socket.handshake.query);

  // Used for mediaSoup room
github michaelfig / mediasoup-broadcast-example / server / wsserver.js View on Github external
if (process.env.RTC_ANNOUNCED_IPV4) {
    // This is the external IP address that routes to the current
    // instance.  For cloud providers or Kubernetes, this
    // will be a different address than the connected network
    // interface will use.
    msOptions.rtcAnnouncedIPv4 = process.env.RTC_ANNOUNCED_IPV4;
}
if (process.env.RTC_ANNOUNCED_IPV6) {
    msOptions.rtcAnnouncedIPv6 = process.env.RTC_ANNOUNCED_IPV6;
}
if (process.env.LOG_LEVEL) {
    console.log('Setting logLevel to', process.env.LOG_LEVEL)
    msOptions.logLevel = process.env.LOG_LEVEL;
    msOptions.logTags = [ 'info', 'ice', 'dlts', 'rtp', 'srtp', 'rtcp', 'rbe', 'rtx' ];
}
const ms = mediasoup.Server(msOptions);

const PUBLISHER_PEER = 'publisher';
const rooms = {};
const MEDIA_CODECS = [
    {
      kind        : "audio",
      name        : "opus",
      clockRate   : 48000,
      channels    : 2,
      parameters  :
      {
        useinbandfec : 1
      }
    },
    /*
    // FIXME: Safari 11 doesn't suppport vp8, so we need just h264 for portability.
github havfo / multiparty-meeting / server / mediasoup.js View on Github external
const mediasoup = require('mediasoup');
const readline = require('readline');
const colors = require('colors/safe');
const repl = require('repl');
const homer = require('./lib/homer');
const config = require('./config');

// mediasoup server.
const mediaServer = mediasoup.Server(
	{
		numWorkers       : 1,
		logLevel         : config.mediasoup.logLevel,
		logTags          : config.mediasoup.logTags,
		rtcIPv4          : config.mediasoup.rtcIPv4,
		rtcIPv6          : config.mediasoup.rtcIPv6,
		rtcAnnouncedIPv4 : config.mediasoup.rtcAnnouncedIPv4,
		rtcAnnouncedIPv6 : config.mediasoup.rtcAnnouncedIPv6,
		rtcMinPort       : config.mediasoup.rtcMinPort,
		rtcMaxPort       : config.mediasoup.rtcMaxPort
	});

// Do Homer stuff.
if (process.env.MEDIASOUP_HOMER_OUTPUT)
	homer(mediaServer);
github tan-tan-kanarek / mediasoup-server / lib / server.js View on Github external
listen(options) {
		this.options = options;

		this.mediaServer = mediasoup.Server(options);

		if(!this.webServer) {
			this.startWebServer();
		}

		this.startSocketIoServer();

		setTimeout(() => {
			this.emit('listen');
		}, 0);

		return this;
	}
github tan-tan-kanarek / mediasoup-server / server.js View on Github external
constructor(options){
		this.options = options;
		this.ip = ip.address();
		this.hostname = os.hostname();
		this.connections = {};
		
		this.start();
		this.connections = {};
		this.rooms = {};
		this.roomsList = {};
		
		this.mediaServer = mediasoup.Server(options);
	}

mediasoup

Cutting Edge WebRTC Video Conferencing

ISC
Latest version published 3 days ago

Package Health Score

87 / 100
Full package analysis