Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const tap = require("tap");
const MediaServer = require("../index");
const SemanticSDP = require("semantic-sdp");
const SDPInfo = SemanticSDP.SDPInfo;
const MediaInfo = SemanticSDP.MediaInfo;
const CandidateInfo = SemanticSDP.CandidateInfo;
const DTLSInfo = SemanticSDP.DTLSInfo;
const ICEInfo = SemanticSDP.ICEInfo;
const StreamInfo = SemanticSDP.StreamInfo;
const TrackInfo = SemanticSDP.TrackInfo;
const Setup = SemanticSDP.Setup;
const CodecInfo = SemanticSDP.CodecInfo;
MediaServer.enableLog(false);
//Create RTP properties
const rtp = {
audio : new MediaInfo("audio","audio"),
video : new MediaInfo("video","video")
};
const Native = require("./Native");
const SemanticSDP = require("semantic-sdp");
const MediaInfo = SemanticSDP.MediaInfo;
function convertRTPProperties(rtp)
{
//Create new native properties object
let properties = new Native.PropertiesFacade();
//If we have got audio
if (rtp.audio)
{
let num = 0;
//Supppor plain and Semantic SDP objects
const audio = rtp.audio.constructor.name === "MediaInfo" ? rtp.audio : MediaInfo.expand(rtp.audio);
//For each codec
for (let codec of audio.getCodecs().values())
const Native = require("./Native");
const EventEmitter = require('events').EventEmitter;
const SemanticSDP = require("semantic-sdp");
const IncomingStreamTrack = require("./IncomingStreamTrack");
const SDPInfo = SemanticSDP.SDPInfo;
const Setup = SemanticSDP.Setup;
const MediaInfo = SemanticSDP.MediaInfo;
const CandidateInfo = SemanticSDP.CandidateInfo;
const DTLSInfo = SemanticSDP.DTLSInfo;
const ICEInfo = SemanticSDP.ICEInfo;
const StreamInfo = SemanticSDP.StreamInfo;
const TrackInfo = SemanticSDP.TrackInfo;
/**
* The incoming streams represent the recived media stream from a remote peer.
*/
class IncomingStream
{
/**
* @ignore
* @hideconstructor
* private constructor
*/
//Get the Medooze Media Server interface
const MediaServer = require("medooze-media-server");
//Get Semantic SDP objects
const SemanticSDP = require("semantic-sdp");
const SDPInfo = SemanticSDP.SDPInfo;
const MediaInfo = SemanticSDP.MediaInfo;
const CandidateInfo = SemanticSDP.CandidateInfo;
const DTLSInfo = SemanticSDP.DTLSInfo;
const ICEInfo = SemanticSDP.ICEInfo;
const StreamInfo = SemanticSDP.StreamInfo;
const TrackInfo = SemanticSDP.TrackInfo;
const Direction = SemanticSDP.Direction;
const CodecInfo = SemanticSDP.CodecInfo;
const Capabilities = {
audio : {
codecs : ["opus"],
extensions : [ "urn:ietf:params:rtp-hdrext:ssrc-audio-level", "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"]
},
video : {
codecs : ["vp9","h264;packetization-mode=1"],
rtx : true,
const EventEmitter = require('events').EventEmitter;
const LFSR = require('lfsr');
const uuidV4 = require('uuid/v4');
const SemanticSDP = require("semantic-sdp");
const SDPInfo = SemanticSDP.SDPInfo;
const Setup = SemanticSDP.Setup;
const MediaInfo = SemanticSDP.MediaInfo;
const CandidateInfo = SemanticSDP.CandidateInfo;
const DTLSInfo = SemanticSDP.DTLSInfo;
const ICEInfo = SemanticSDP.ICEInfo;
const StreamInfo = SemanticSDP.StreamInfo;
const TrackInfo = SemanticSDP.TrackInfo;
const SourceGroupInfo = SemanticSDP.SourceGroupInfo;
/**
* Manager of remoe peer connecion clients
*/
class PeerConnectionServer
{
/**
* @ignore
* @hideconstructor
//Server IP address
const ip = "127.0.0.1";
const SemanticSDP = require("semantic-sdp");
const SDPInfo = SemanticSDP.SDPInfo;
const MediaInfo = SemanticSDP.MediaInfo;
const CandidateInfo = SemanticSDP.CandidateInfo;
const DTLSInfo = SemanticSDP.DTLSInfo;
const ICEInfo = SemanticSDP.ICEInfo;
const StreamInfo = SemanticSDP.StreamInfo;
const TrackInfo = SemanticSDP.TrackInfo;
const sdp = "v=0\r\n" +
"o=- 4327261771880257373 2 IN IP4 127.0.0.1\r\n" +
"s=-\r\n" +
"t=0 0\r\n" +
"a=group:BUNDLE audio video\r\n" +
"a=msid-semantic: WMS xIKmAwWv4ft4ULxNJGhkHzvPaCkc8EKo4SGj\r\n" +
"m=audio 9 UDP/TLS/RTP/SAVPF 111 103 104 9 0 8 106 105 13 110 112 113 126\r\n" +
"c=IN IP4 0.0.0.0\r\n" +
"a=rtcp:9 IN IP4 0.0.0.0\r\n" +
const Native = require("./Native");
const EventEmitter = require('events').EventEmitter;
const Transport = require("./Transport");
const PeerConnectionServer = require("./PeerConnectionServer");
const SDPManagerUnified = require("./SDPManagerUnified");
const SDPManagerPlanB = require("./SDPManagerPlanB");
const IncomingStream = require("./IncomingStream");
const IncomingStreamTrackMirrored = require("./IncomingStreamTrackMirrored");
const SemanticSDP = require("semantic-sdp");
const SDPInfo = SemanticSDP.SDPInfo;
const MediaInfo = SemanticSDP.MediaInfo;
const CandidateInfo = SemanticSDP.CandidateInfo;
const DTLSInfo = SemanticSDP.DTLSInfo;
const ICEInfo = SemanticSDP.ICEInfo;
const StreamInfo = SemanticSDP.StreamInfo;
const TrackInfo = SemanticSDP.TrackInfo;
const Setup = SemanticSDP.Setup;
/**
* An endpoint represent an UDP server socket.
* The endpoint will process STUN requests in order to be able to associate the remote ip:port with the registered transport and forward any further data comming from that transport.
* Being a server it is ICE-lite.
*/
class Endpoint
{
/**
* @ignore
//Server IP address
const ip = "127.0.0.1";
const SemanticSDP = require("semantic-sdp");
const SDPInfo = SemanticSDP.SDPInfo;
const MediaInfo = SemanticSDP.MediaInfo;
const CodecInfo = SemanticSDP.CodecInfo;
const CandidateInfo = SemanticSDP.CandidateInfo;
const DTLSInfo = SemanticSDP.DTLSInfo;
const ICEInfo = SemanticSDP.ICEInfo;
const StreamInfo = SemanticSDP.StreamInfo;
const TrackInfo = SemanticSDP.TrackInfo;
const Setup = SemanticSDP.Setup;
//Get the Medooze Media Server interface
const MediaServer = require("../index");
//Enable debug
//MediaServer.enableDebug(true);
//MediaServer.enableUltraDebug(true);
const player = MediaServer.createPlayer("/tmp/recording.mp4");
const getPort = require('get-port');
const medoozeMediaServer = require('medooze-media-server');
const format = require('string-format');
const execa = require('execa');
const SemanticSDP = require('semantic-sdp');
const SDPInfo = SemanticSDP.SDPInfo;
const MediaInfo = SemanticSDP.MediaInfo;
const CandidateInfo = SemanticSDP.CandidateInfo;
const DTLSInfo = SemanticSDP.DTLSInfo;
const ICEInfo = SemanticSDP.ICEInfo;
const StreamInfo = SemanticSDP.StreamInfo;
const TrackInfo = SemanticSDP.TrackInfo;
const Direction = SemanticSDP.Direction;
const CodecInfo = SemanticSDP.CodecInfo;
const videoPt = 96;
const audioPt = 100;
const videoCodec = 'h264';
const audioCodec = 'opus';
let videoPort = null;
let audioPort = null;
const Native = require("./Native");
const EventEmitter = require('events').EventEmitter;
const SemanticSDP = require("semantic-sdp");
const SDPInfo = SemanticSDP.SDPInfo;
const Setup = SemanticSDP.Setup;
const MediaInfo = SemanticSDP.MediaInfo;
const CandidateInfo = SemanticSDP.CandidateInfo;
const DTLSInfo = SemanticSDP.DTLSInfo;
const ICEInfo = SemanticSDP.ICEInfo;
const StreamInfo = SemanticSDP.StreamInfo;
const TrackInfo = SemanticSDP.TrackInfo;
const SourceGroupInfo = SemanticSDP.SourceGroupInfo;
const Transponder = require("./Transponder");
function getStatsFromOutgoingSource(source)
{
return {
numPackets : source.numPackets,
numRTCPPackets : source.numRTCPPackets,
totalBytes : source.totalBytes,
totalRTCPBytes : source.totalRTCPBytes,