@signalwire/js
Advanced tools
Comparing version 1.3.0-cantina.19 to 1.3.0-cantina.20
export declare const checkPermissions: (kind?: string) => Promise<boolean>; | ||
export declare const checkVideoPermissions: () => Promise<boolean>; | ||
export declare const checkAudioPermissions: () => Promise<boolean>; | ||
export declare const getDevicesWithPermissions: (kind?: string, fullList?: boolean) => Promise<MediaDeviceInfo[]>; | ||
export declare const getVideoDevicesWithPermissions: () => Promise<MediaDeviceInfo[]>; | ||
export declare const getAudioInDevicesWithPermissions: () => Promise<MediaDeviceInfo[]>; | ||
export declare const getAudioOutDevicesWithPermissions: () => Promise<MediaDeviceInfo[]>; | ||
export declare const getDevices: (kind?: string, fullList?: boolean) => Promise<MediaDeviceInfo[]>; | ||
@@ -14,1 +18,2 @@ export declare const getVideoDevices: () => Promise<MediaDeviceInfo[]>; | ||
export declare const checkDeviceIdConstraints: (id: string, label: string, kind: MediaDeviceKind, constraints: MediaTrackConstraints) => Promise<MediaTrackConstraints>; | ||
export declare const requestPermissions: (constraints: MediaStreamConstraints) => Promise<void>; |
@@ -29,14 +29,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}; | ||
export const getDevices = (kind = null, fullList = false) => __awaiter(void 0, void 0, void 0, function* () { | ||
export const getDevicesWithPermissions = (kind = null, fullList = false) => __awaiter(void 0, void 0, void 0, function* () { | ||
const hasPerms = yield checkPermissions(kind); | ||
if (hasPerms === null) { | ||
return []; | ||
} | ||
else if (hasPerms === false) { | ||
if (hasPerms === false) { | ||
const constraints = _constraintsByKind(kind); | ||
const stream = yield WebRTC.getUserMedia(constraints); | ||
WebRTC.stopStream(stream); | ||
return getDevices(kind); | ||
} | ||
let devices = yield WebRTC.enumerateDevicesByKind(kind); | ||
return getDevices(kind, fullList); | ||
}); | ||
export const getVideoDevicesWithPermissions = () => getDevicesWithPermissions(DeviceType.Video); | ||
export const getAudioInDevicesWithPermissions = () => getDevicesWithPermissions(DeviceType.AudioIn); | ||
export const getAudioOutDevicesWithPermissions = () => getDevicesWithPermissions(DeviceType.AudioOut); | ||
export const getDevices = (kind = null, fullList = false) => __awaiter(void 0, void 0, void 0, function* () { | ||
const devices = yield WebRTC.enumerateDevicesByKind(kind); | ||
if (fullList === true) { | ||
@@ -46,3 +48,6 @@ return devices; | ||
const found = []; | ||
devices = devices.filter(({ kind, groupId }) => { | ||
return devices.filter(({ deviceId, label, kind, groupId }) => { | ||
if (!deviceId || !label) { | ||
return false; | ||
} | ||
if (!groupId) { | ||
@@ -58,3 +63,2 @@ return true; | ||
}); | ||
return devices; | ||
}); | ||
@@ -104,1 +108,10 @@ export const getVideoDevices = () => getDevices(DeviceType.Video); | ||
}); | ||
export const requestPermissions = (constraints) => __awaiter(void 0, void 0, void 0, function* () { | ||
try { | ||
const stream = yield WebRTC.getUserMedia(constraints); | ||
WebRTC.stopStream(stream); | ||
} | ||
catch (error) { | ||
throw error; | ||
} | ||
}); |
import Relay from './src/SignalWire'; | ||
import Verto from './src/Verto'; | ||
import CantinaAuth from '../common/src/webrtc/CantinaAuth'; | ||
export declare const VERSION = "1.3.0-cantina.19"; | ||
export declare const VERSION = "1.3.0-cantina.20"; | ||
export { Relay, Verto, CantinaAuth }; | ||
@@ -6,0 +6,0 @@ export * from '../common/src/webrtc/deviceHelpers'; |
@@ -5,5 +5,5 @@ import Relay from './src/SignalWire'; | ||
import CantinaAuth from '../common/src/webrtc/CantinaAuth'; | ||
export const VERSION = '1.3.0-cantina.19'; | ||
export const VERSION = '1.3.0-cantina.20'; | ||
setAgentName(`JavaScript SDK/${VERSION}`); | ||
export { Relay, Verto, CantinaAuth }; | ||
export * from '../common/src/webrtc/deviceHelpers'; |
{ | ||
"name": "@signalwire/js", | ||
"version": "1.3.0-cantina.19", | ||
"version": "1.3.0-cantina.20", | ||
"description": "Relay SDK for JavaScript to connect to SignalWire.", | ||
@@ -5,0 +5,0 @@ "author": "SignalWire Team <open.source@signalwire.com>", |
Sorry, the diff of this file is too big to display
384689
5542