@signalapp/ringrtc
Advanced tools
Comparing version 2.33.0 to 2.34.0
@@ -217,2 +217,3 @@ /// <reference types="node" /> | ||
handleReactions(clientId: GroupCallClientId, reactions: Array<Reaction>): void; | ||
handleRaisedHands(clientId: GroupCallClientId, raisedHands: Array<number>): void; | ||
handleRemoteDevicesChanged(clientId: GroupCallClientId, remoteDeviceStates: Array<RemoteDeviceState>): void; | ||
@@ -264,2 +265,3 @@ handlePeekChanged(clientId: GroupCallClientId, info: PeekInfo): void; | ||
password?: string; | ||
hostname?: string; | ||
urls: Array<string>; | ||
@@ -445,2 +447,3 @@ } | ||
onReactions(groupCall: GroupCall, reactions: Array<Reaction>): void; | ||
onRaisedHands(groupCall: GroupCall, raisedHands: Array<number>): void; | ||
onPeekChanged(groupCall: GroupCall): void; | ||
@@ -469,2 +472,3 @@ onEnded(groupCall: GroupCall, reason: GroupCallEndReason): void; | ||
react(value: string): void; | ||
raiseHand(raise: boolean): void; | ||
setOutgoingVideoMuted(muted: boolean): void; | ||
@@ -491,2 +495,3 @@ setPresenting(presenting: boolean): void; | ||
handleReactions(reactions: Array<Reaction>): void; | ||
handleRaisedHands(raisedHands: Array<number>): void; | ||
handleRemoteDevicesChanged(remoteDeviceStates: Array<RemoteDeviceState>): void; | ||
@@ -579,3 +584,3 @@ handlePeekChanged(info: PeekInfo): void; | ||
createOutgoingCall(remoteUserId: UserId, isVideoCall: boolean, localDeviceId: DeviceId): CallId; | ||
proceed(callId: CallId, iceServerUsername: string, iceServerPassword: string, iceServerUrls: Array<string>, hideIp: boolean, dataMode: DataMode, audioLevelsIntervalMillis: number): void; | ||
proceed(callId: CallId, iceServerUsername: string, iceServerPassword: string, iceServerHostname: string, iceServerUrls: Array<string>, hideIp: boolean, dataMode: DataMode, audioLevelsIntervalMillis: number): void; | ||
accept(callId: CallId): void; | ||
@@ -614,2 +619,3 @@ ignore(callId: CallId): void; | ||
groupReact(clientId: GroupCallClientId, value: string): void; | ||
groupRaiseHand(clientId: GroupCallClientId, raise: boolean): void; | ||
resendMediaKeys(clientId: GroupCallClientId): void; | ||
@@ -616,0 +622,0 @@ setDataMode(clientId: GroupCallClientId, dataMode: DataMode): void; |
@@ -6,11 +6,2 @@ "use strict"; | ||
// | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -70,4 +61,3 @@ exports.CanvasVideoRenderer = exports.MAX_VIDEO_CAPTURE_BUFFER_SIZE = exports.MAX_VIDEO_CAPTURE_AREA = exports.MAX_VIDEO_CAPTURE_HEIGHT = exports.MAX_VIDEO_CAPTURE_WIDTH = exports.GumVideoCapturer = exports.GumVideoCaptureOptions = exports.VideoPixelFormatEnum = void 0; | ||
setLocalPreview(localPreview) { | ||
var _a; | ||
const oldLocalPreview = (_a = this.localPreview) === null || _a === void 0 ? void 0 : _a.current; | ||
const oldLocalPreview = this.localPreview?.current; | ||
if (oldLocalPreview) { | ||
@@ -93,3 +83,3 @@ oldLocalPreview.srcObject = null; | ||
// eslint-disable-next-line @typescript-eslint/no-floating-promises | ||
this.startCapturing(options !== null && options !== void 0 ? options : this.defaultCaptureOptions); | ||
this.startCapturing(options ?? this.defaultCaptureOptions); | ||
this.startSending(sender); | ||
@@ -106,25 +96,20 @@ } | ||
// eslint-disable-next-line @typescript-eslint/require-await | ||
setPreferredDevice(deviceId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
this.preferredDeviceId = deviceId; | ||
if (this.captureOptions) { | ||
const { captureOptions, sender } = this; | ||
this.disable(); | ||
// eslint-disable-next-line @typescript-eslint/no-floating-promises | ||
this.startCapturing(captureOptions); | ||
if (sender) { | ||
this.startSending(sender); | ||
} | ||
async setPreferredDevice(deviceId) { | ||
this.preferredDeviceId = deviceId; | ||
if (this.captureOptions) { | ||
const { captureOptions, sender } = this; | ||
this.disable(); | ||
// eslint-disable-next-line @typescript-eslint/no-floating-promises | ||
this.startCapturing(captureOptions); | ||
if (sender) { | ||
this.startSending(sender); | ||
} | ||
}); | ||
} | ||
} | ||
enumerateDevices() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const devices = yield window.navigator.mediaDevices.enumerateDevices(); | ||
const cameras = devices.filter(d => d.kind == 'videoinput'); | ||
return cameras; | ||
}); | ||
async enumerateDevices() { | ||
const devices = await window.navigator.mediaDevices.enumerateDevices(); | ||
const cameras = devices.filter(d => d.kind == 'videoinput'); | ||
return cameras; | ||
} | ||
getUserMedia(options) { | ||
var _a; | ||
// TODO: Figure out a better way to make typescript accept "mandatory". | ||
@@ -134,3 +119,3 @@ const constraints = { | ||
video: { | ||
deviceId: (_a = options.preferredDeviceId) !== null && _a !== void 0 ? _a : this.preferredDeviceId, | ||
deviceId: options.preferredDeviceId ?? this.preferredDeviceId, | ||
width: { | ||
@@ -164,56 +149,54 @@ max: options.maxWidth, | ||
} | ||
startCapturing(options) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (this.capturing()) { | ||
index_1.RingRTC.logWarn('startCapturing(): already capturing'); | ||
async startCapturing(options) { | ||
if (this.capturing()) { | ||
index_1.RingRTC.logWarn('startCapturing(): already capturing'); | ||
return; | ||
} | ||
index_1.RingRTC.logInfo(`startCapturing(): ${options.maxWidth}x${options.maxHeight}@${options.maxFramerate}`); | ||
this.captureOptions = options; | ||
try { | ||
// If we start/stop/start, we may have concurrent calls to getUserMedia, | ||
// which is what we want if we're switching from camera to screenshare. | ||
// But we need to make sure we deal with the fact that things might be | ||
// different after the await here. | ||
const mediaStream = await this.getUserMedia(options); | ||
// It's possible video was disabled, switched to screenshare, or | ||
// switched to a different camera while awaiting a response, in | ||
// which case we need to disable the camera we just accessed. | ||
if (this.captureOptions != options) { | ||
index_1.RingRTC.logWarn('startCapturing(): different state after getUserMedia()'); | ||
for (const track of mediaStream.getVideoTracks()) { | ||
// Make the light turn off faster | ||
track.stop(); | ||
} | ||
return; | ||
} | ||
index_1.RingRTC.logInfo(`startCapturing(): ${options.maxWidth}x${options.maxHeight}@${options.maxFramerate}`); | ||
this.captureOptions = options; | ||
try { | ||
// If we start/stop/start, we may have concurrent calls to getUserMedia, | ||
// which is what we want if we're switching from camera to screenshare. | ||
// But we need to make sure we deal with the fact that things might be | ||
// different after the await here. | ||
const mediaStream = yield this.getUserMedia(options); | ||
// It's possible video was disabled, switched to screenshare, or | ||
// switched to a different camera while awaiting a response, in | ||
// which case we need to disable the camera we just accessed. | ||
if (this.captureOptions != options) { | ||
index_1.RingRTC.logWarn('startCapturing(): different state after getUserMedia()'); | ||
for (const track of mediaStream.getVideoTracks()) { | ||
// Make the light turn off faster | ||
track.stop(); | ||
} | ||
return; | ||
if (this.mediaStream !== undefined && | ||
this.mediaStream.getVideoTracks().length > 0) { | ||
// We have a stream and track for the requested camera already. Stop | ||
// the duplicate track that we just started. | ||
index_1.RingRTC.logWarn('startCapturing(): dropping duplicate call to startCapturing'); | ||
for (const track of mediaStream.getVideoTracks()) { | ||
track.stop(); | ||
} | ||
if (this.mediaStream !== undefined && | ||
this.mediaStream.getVideoTracks().length > 0) { | ||
// We have a stream and track for the requested camera already. Stop | ||
// the duplicate track that we just started. | ||
index_1.RingRTC.logWarn('startCapturing(): dropping duplicate call to startCapturing'); | ||
for (const track of mediaStream.getVideoTracks()) { | ||
track.stop(); | ||
} | ||
return; | ||
} | ||
this.mediaStream = mediaStream; | ||
if (!this.spawnedSenderRunning && | ||
this.mediaStream != undefined && | ||
this.sender != undefined) { | ||
this.spawnSender(this.mediaStream, this.sender); | ||
} | ||
this.updateLocalPreviewSourceObject(); | ||
return; | ||
} | ||
catch (e) { | ||
index_1.RingRTC.logError(`startCapturing(): ${e}`); | ||
// It's possible video was disabled, switched to screenshare, or | ||
// switched to a different camera while awaiting a response, in | ||
// which case we should reset the captureOptions if we set them. | ||
if (this.captureOptions == options) { | ||
// We couldn't open the camera. Oh well. | ||
this.captureOptions = undefined; | ||
} | ||
this.mediaStream = mediaStream; | ||
if (!this.spawnedSenderRunning && | ||
this.mediaStream != undefined && | ||
this.sender != undefined) { | ||
this.spawnSender(this.mediaStream, this.sender); | ||
} | ||
}); | ||
this.updateLocalPreviewSourceObject(); | ||
} | ||
catch (e) { | ||
index_1.RingRTC.logError(`startCapturing(): ${e}`); | ||
// It's possible video was disabled, switched to screenshare, or | ||
// switched to a different camera while awaiting a response, in | ||
// which case we should reset the captureOptions if we set them. | ||
if (this.captureOptions == options) { | ||
// We couldn't open the camera. Oh well. | ||
this.captureOptions = undefined; | ||
} | ||
} | ||
} | ||
@@ -266,7 +249,6 @@ stopCapturing() { | ||
// eslint-disable-next-line @typescript-eslint/no-floating-promises | ||
(() => __awaiter(this, void 0, void 0, function* () { | ||
var _a; | ||
(async () => { | ||
try { | ||
while (mediaStream == this.mediaStream) { | ||
const { done, value: frame } = yield reader.read(); | ||
const { done, value: frame } = await reader.read(); | ||
if (done) { | ||
@@ -279,3 +261,3 @@ break; | ||
try { | ||
const format = videoPixelFormatToEnum((_a = frame.format) !== null && _a !== void 0 ? _a : 'I420'); | ||
const format = videoPixelFormatToEnum(frame.format ?? 'I420'); | ||
if (format == undefined) { | ||
@@ -289,3 +271,3 @@ index_1.RingRTC.logWarn(`Unsupported video frame format: ${frame.format}`); | ||
} | ||
yield frame.copyTo(buffer); | ||
await frame.copyTo(buffer); | ||
if (sender !== this.sender) { | ||
@@ -312,3 +294,3 @@ break; | ||
this.spawnedSenderRunning = false; | ||
}))(); | ||
})(); | ||
} | ||
@@ -400,3 +382,2 @@ stopSending() { | ||
renderVideoFrame() { | ||
var _a, _b; | ||
if (!this.source || !this.canvas) { | ||
@@ -449,3 +430,3 @@ return; | ||
} | ||
if (((_a = this.imageData) === null || _a === void 0 ? void 0 : _a.width) !== width || ((_b = this.imageData) === null || _b === void 0 ? void 0 : _b.height) !== height) { | ||
if (this.imageData?.width !== width || this.imageData?.height !== height) { | ||
this.imageData = new ImageData(width, height); | ||
@@ -452,0 +433,0 @@ } |
{ | ||
"name": "@signalapp/ringrtc", | ||
"version": "2.33.0", | ||
"version": "2.34.0", | ||
"description": "Signal Messenger voice and video calling library.", | ||
@@ -27,3 +27,3 @@ "main": "dist/index.js", | ||
"prebuildUrl": "https://build-artifacts.signal.org/libraries/ringrtc-desktop-build-v${npm_package_version}.tar.gz", | ||
"prebuildChecksum": "4e431ad65093548bd787a8b1a045d1fad3944e74cbc3f031dc53320fba92af7e" | ||
"prebuildChecksum": "7c61350a51f61c6ea06f68c08479260de21be36cc098bcca1d6392af579bd73f" | ||
}, | ||
@@ -30,0 +30,0 @@ "author": "", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
394699
3267