New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@messagebird/client

Package Overview
Dependencies
Maintainers
83
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@messagebird/client - npm Package Compare versions

Comparing version 0.15.0-next.5 to 0.15.0-next.6

dist-src/MediaManager.js

7

CHANGELOG.md

@@ -0,1 +1,8 @@

# [0.15.0-next.5](https://git.messagebird.io/frontend/javascript-webrtc-sdk/compare/v0.15.0-next.4...v0.15.0-next.5) (2020-03-20)
### Bug Fixes
* test ([4de8003](https://git.messagebird.io/frontend/javascript-webrtc-sdk/commit/4de8003b1d25b51f3ffa06f27f33e1ec86b14e5c))
# [0.15.0-next.4](https://git.messagebird.io/frontend/javascript-webrtc-sdk/compare/v0.15.0-next.3...v0.15.0-next.4) (2020-03-20)

@@ -2,0 +9,0 @@

152

dist-node/index.js

@@ -38,3 +38,3 @@ 'use strict';

function getSDKVersionHeader() {
var version = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "21e3dd48" ;
var version = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "a9f3b0bc" ;
return "SDK-Version: ".concat(version);

@@ -711,2 +711,146 @@ }

var MediaManager = function MediaManager(connection) {
var _this = this;
_classCallCheck(this, MediaManager);
_defineProperty(this, "eventEmitter", new events.EventEmitter());
_defineProperty(this, "rtcConnection", void 0);
_defineProperty(this, "_handleDeviceChange", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
var devices;
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return _this.get();
case 2:
devices = _context.sent;
_this.eventEmitter.emit('devicechange', devices);
case 4:
case "end":
return _context.stop();
}
}
}, _callee);
})));
_defineProperty(this, "get", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
var data, devices;
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
data = {
inputs: {
audio: [],
video: []
},
outputs: {
audio: []
}
};
_context2.prev = 1;
_context2.next = 4;
return navigator.mediaDevices.enumerateDevices();
case 4:
devices = _context2.sent;
devices.forEach(function (device) {
var _device$kind$split = device.kind.split(/(input|output)/gi),
_device$kind$split2 = _slicedToArray(_device$kind$split, 2),
kind = _device$kind$split2[0],
type = _device$kind$split2[1];
type === 'input' ? data.inputs[kind].push(device) : data.outputs[kind].push(device);
});
_context2.next = 10;
break;
case 8:
_context2.prev = 8;
_context2.t0 = _context2["catch"](1);
case 10:
return _context2.abrupt("return", data);
case 11:
case "end":
return _context2.stop();
}
}
}, _callee2, null, [[1, 8]]);
})));
_defineProperty(this, "on", function (eventName, cb) {
_this.eventEmitter.on(eventName, cb);
});
_defineProperty(this, "off", function (eventName, cb) {
_this.eventEmitter.off(eventName, cb);
});
_defineProperty(this, "set", /*#__PURE__*/function () {
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(constraints) {
var nextStream;
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
if (_this.rtcConnection.streamTargets) {
_context3.next = 2;
break;
}
throw new Error('Unable to set user media source as there are no active streams.');
case 2:
_context3.next = 4;
return navigator.mediaDevices.getUserMedia(constraints);
case 4:
nextStream = _context3.sent; // Iterate through RTC Connection streams
_this.rtcConnection.streamTargets.forEach(function (stream) {
// Iterate through A/V tracks and stop existing ones
if (constraints.audio) {
var audioTracks = stream.srcObject.getAudioTracks();
audioTracks.forEach(function (track) {
return track.stop();
});
}
if (constraints.video) {
var videoTracks = stream.srcObject.getVideoTracks();
videoTracks.forEach(function (track) {
return track.stop();
});
} // Set the srcObject value of the stream to use new constraints
stream.srcObject = nextStream;
});
case 6:
case "end":
return _context3.stop();
}
}
}, _callee3);
}));
return function (_x) {
return _ref3.apply(this, arguments);
};
}());
this.rtcConnection = connection;
navigator.mediaDevices.ondevicechange = this._handleDeviceChange;
};
var COLLECTION_INTERVAL = 5000;

@@ -731,2 +875,4 @@ var RTCConnection = /*#__PURE__*/function () {

_defineProperty(this, "mediaSources", void 0);
_defineProperty(this, "sendDigits", function (keys) {

@@ -845,2 +991,3 @@ var isValidInput = isValidDTmfInput(keys);

this.sipRTCSession.on('progress', this.handleProgress);
this.mediaSources = new MediaManager(this);
}

@@ -1057,3 +1204,3 @@

if (statusCode !== exports.SipStatusCodes.Ringing && statusCode !== exports.SipStatusCodes.SessionProgress) {
if (statusCode !== exports.SipStatusCodes.Ringing && statusCode !== exports.SipStatusCodes.SessionProgress && statusCode !== exports.SipStatusCodes.Ok) {
return;

@@ -1509,2 +1656,3 @@ } // Clear any existing timeouts that may exist.

exports.InternalError = InternalError;
exports.MediaManager = MediaManager;
exports.NotAcceptableError = NotAcceptableError;

@@ -1511,0 +1659,0 @@ exports.OutgoingRTCConnection = OutgoingRTCConnection;

2

dist-src/headers.js

@@ -13,3 +13,3 @@ import platform from 'platform';

export function getSDKVersionHeader() {
var version = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "21e3dd48" || 'HEAD';
var version = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "a9f3b0bc" || 'HEAD';
return "SDK-Version: ".concat(version);

@@ -16,0 +16,0 @@ }

import { debug } from 'jssip';
export { Device } from "./Device.js";
export * from "./MediaManager.js";
export { RTCConnection } from "./RTCConnection.js";

@@ -4,0 +5,0 @@ export { IncomingRTCConnection } from "./IncomingRTCConnection.js";

@@ -100,3 +100,3 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";

if (statusCode !== SipStatusCodes.Ringing && statusCode !== SipStatusCodes.SessionProgress) {
if (statusCode !== SipStatusCodes.Ringing && statusCode !== SipStatusCodes.SessionProgress && statusCode !== SipStatusCodes.Ok) {
return;

@@ -103,0 +103,0 @@ } // Clear any existing timeouts that may exist.

@@ -6,2 +6,3 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";

import _defineProperty from "@babel/runtime/helpers/defineProperty";
// @ts-nocheck
import { SipStatusCodes, ConnectionStatus } from "./domain.js";

@@ -12,2 +13,3 @@ import { EventEmitter } from 'events';

import { StatsReport } from "./StatsReport.js";
import { MediaManager } from "./MediaManager.js";
var COLLECTION_INTERVAL = 5000;

@@ -32,2 +34,4 @@ export var RTCConnection = /*#__PURE__*/function () {

_defineProperty(this, "mediaSources", void 0);
_defineProperty(this, "sendDigits", function (keys) {

@@ -146,2 +150,3 @@ var isValidInput = isValidDTmfInput(keys);

this.sipRTCSession.on('progress', this.handleProgress);
this.mediaSources = new MediaManager(this);
}

@@ -148,0 +153,0 @@

@@ -26,2 +26,7 @@ /// <reference types="jest" />

}
export declare class MockRTCPeerConnection implements RTCPeerConnection {
addEventListener: () => void;
getStats(): Promise<RTCStatsReport>;
sendInfo(): void;
}
export declare class RTCSession {

@@ -28,0 +33,0 @@ events: EventEmitter;

export { Device } from './Device';
export * from './MediaManager';
export { RTCConnection } from './RTCConnection';

@@ -3,0 +4,0 @@ export { IncomingRTCConnection } from './IncomingRTCConnection';

@@ -6,2 +6,3 @@ /// <reference types="node" />

import { EventEmitter } from 'events';
import { MediaManager } from './MediaManager';
export declare class RTCConnection {

@@ -11,5 +12,6 @@ protected _status: ConnectionStatus;

protected sipRTCSession: SipRTCSession;
private streamTargets;
streamTargets: HTMLVideoElement[];
protected _callId: string;
private statsTimeout;
mediaSources: MediaManager;
constructor(sipRtcSession: SipRTCSession);

@@ -36,3 +38,3 @@ on(name: 'confirmed', cb: (data: SessionConfirmedEventData) => void): void;

handleMute: (muted: boolean) => Promise<boolean>;
sendInfoMessage(message: Object): void;
sendInfoMessage(message: any): void;
private getStatsReport;

@@ -39,0 +41,0 @@ private getAndSendStats;

@@ -32,3 +32,3 @@ import { WebSocketInterface, UA, debug } from 'jssip';

function getSDKVersionHeader() {
var version = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "21e3dd48" ;
var version = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "a9f3b0bc" ;
return "SDK-Version: ".concat(version);

@@ -711,2 +711,147 @@ }

var MediaManager = function MediaManager(connection) {
var _this = this;
_classCallCheck(this, MediaManager);
_defineProperty(this, "eventEmitter", new EventEmitter());
_defineProperty(this, "rtcConnection", void 0);
_defineProperty(this, "_handleDeviceChange", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
var devices;
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return _this.get();
case 2:
devices = _context.sent;
_this.eventEmitter.emit('devicechange', devices);
case 4:
case "end":
return _context.stop();
}
}
}, _callee);
})));
_defineProperty(this, "get", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
var data, devices;
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
data = {
inputs: {
audio: [],
video: []
},
outputs: {
audio: []
}
};
_context2.prev = 1;
_context2.next = 4;
return navigator.mediaDevices.enumerateDevices();
case 4:
devices = _context2.sent;
devices.forEach(function (device) {
var _device$kind$split = device.kind.split(/(input|output)/gi),
_device$kind$split2 = _slicedToArray(_device$kind$split, 2),
kind = _device$kind$split2[0],
type = _device$kind$split2[1];
type === 'input' ? data.inputs[kind].push(device) : data.outputs[kind].push(device);
});
_context2.next = 10;
break;
case 8:
_context2.prev = 8;
_context2.t0 = _context2["catch"](1);
case 10:
return _context2.abrupt("return", data);
case 11:
case "end":
return _context2.stop();
}
}
}, _callee2, null, [[1, 8]]);
})));
_defineProperty(this, "on", function (eventName, cb) {
_this.eventEmitter.on(eventName, cb);
});
_defineProperty(this, "off", function (eventName, cb) {
_this.eventEmitter.off(eventName, cb);
});
_defineProperty(this, "set", /*#__PURE__*/function () {
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(constraints) {
var nextStream;
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
if (_this.rtcConnection.streamTargets) {
_context3.next = 2;
break;
}
throw new Error('Unable to set user media source as there are no active streams.');
case 2:
_context3.next = 4;
return navigator.mediaDevices.getUserMedia(constraints);
case 4:
nextStream = _context3.sent;
// Iterate through RTC Connection streams
_this.rtcConnection.streamTargets.forEach(function (stream) {
// Iterate through A/V tracks and stop existing ones
if (constraints.audio) {
var audioTracks = stream.srcObject.getAudioTracks();
audioTracks.forEach(function (track) {
return track.stop();
});
}
if (constraints.video) {
var videoTracks = stream.srcObject.getVideoTracks();
videoTracks.forEach(function (track) {
return track.stop();
});
} // Set the srcObject value of the stream to use new constraints
stream.srcObject = nextStream;
});
case 6:
case "end":
return _context3.stop();
}
}
}, _callee3);
}));
return function (_x) {
return _ref3.apply(this, arguments);
};
}());
this.rtcConnection = connection;
navigator.mediaDevices.ondevicechange = this._handleDeviceChange;
};
var COLLECTION_INTERVAL = 5000;

@@ -731,2 +876,4 @@ var RTCConnection = /*#__PURE__*/function () {

_defineProperty(this, "mediaSources", void 0);
_defineProperty(this, "sendDigits", function (keys) {

@@ -845,2 +992,3 @@ var isValidInput = isValidDTmfInput(keys);

this.sipRTCSession.on('progress', this.handleProgress);
this.mediaSources = new MediaManager(this);
}

@@ -1057,3 +1205,3 @@

if (statusCode !== SipStatusCodes.Ringing && statusCode !== SipStatusCodes.SessionProgress) {
if (statusCode !== SipStatusCodes.Ringing && statusCode !== SipStatusCodes.SessionProgress && statusCode !== SipStatusCodes.Ok) {
return;

@@ -1504,3 +1652,3 @@ } // Clear any existing timeouts that may exist.

export { BadRequestError, ConnectionStatus, Device, ErrorCodes, ForbiddenError, IncomingRTCConnection, InternalError, NotAcceptableError, OutgoingRTCConnection, RTCConnection, SipStatusCodes, __internalToggleDebugMode };
export { BadRequestError, ConnectionStatus, Device, ErrorCodes, ForbiddenError, IncomingRTCConnection, InternalError, MediaManager, NotAcceptableError, OutgoingRTCConnection, RTCConnection, SipStatusCodes, __internalToggleDebugMode };
//# sourceMappingURL=index.js.map
{
"name": "@messagebird/client",
"version": "0.15.0-next.5",
"version": "0.15.0-next.6",
"license": "UNLICENSED",

@@ -5,0 +5,0 @@ "files": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc