@salutejs/jazz-sdk-web
Version:
Jazz SDK for web applications
1,828 lines (1,814 loc) • 62.8 kB
TypeScript
import { Container, Module, ModuleDeclaration } from 'ditox';
import { JitsiLocalTrackEffect, JitsiVideoResolution } from 'lib-jitsi-meet';
import { Atom, Scope as Scope$0, Signal } from 'nrgy';
import { Controller, Query, Query as RxEffectsQuery } from 'rx-effects';
import { Observable } from 'rxjs';
type LogMetadata = Readonly<Record<string, string>>;
type LogFunction = (...data: unknown[]) => void;
type Logger = {
/**
* Returns a nested logger
*/
getLogger: typeof getLogger;
withMeta: (meta: LogMetadata) => Logger;
debug: LogFunction;
log: LogFunction;
info: LogFunction;
warn: LogFunction;
error: LogFunction;
};
declare function getLogger(tag: string, meta?: LogMetadata): Logger;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type AnyObject = Record<string, any>;
type Timestamp = number;
/** Autocomplete for string union with ability use any string
* e.g. 'apple' | 'banana' | string
*
* WARNING: doesn't work as object key with empty default value
* following code will throw type error:
* const obj1: Record<Autocomplete<'foo' | 'bar'>, any> = {}
*/
type StringEnum<Enum extends string> = Enum | (string & Record<never, never>);
type EventLike = {
type: string;
};
/**
* This is a subset of Web Storage API
*/
type KeyValueStorage = Readonly<{
/**
* Returns the current value associated with the given key, or null if the
* given key does not exist in the list associated with the object.
*/
getItem: (key: string) => string | undefined;
/**
* Sets the value of the pair identified by key to value, creating a new
* key/value pair if none existed for key previously.
*
* Throws a "QuotaExceededError" DOMException exception if the new value
* couldn't be set. (Setting could fail if, e.g., the user has disabled
* storage for the site, or if the quota has been exceeded.)
*/
setItem: (key: string, value: string) => void;
/**
* Removes the key/value pair with the given key from the list associated
* with the object, if a key/value pair with the given key exists.
*/
removeItem: (key: string) => void;
/**
* Empties the list associated with the object of all key/value pairs, if
* there are any.
*/
clear: () => void;
getKeys: () => ReadonlyArray<string>;
}>;
type UserRole = StringEnum<'owner' | 'member' | 'viewer'>;
type ConferenceId = string;
// type AudioLevelsStore = Record<ParticipantId, number>;
// #create EndpointMessage
// Actually `AllRemoteVideoMuted`
// type AllParticipantsMuted = boolean;
// #create? AllParticipantsMutedStore
// type ViewMode = 'speaker' | 'tile';
// #create? ViewModeStore
// type ThumbnailsActive = boolean;
// #create? ThumbnailsActiveStore
type ReactionType = 'applause' | 'surprise' | 'smile' | 'like' | 'dislike';
declare const JazzRoomTokens: typeof JazzMeetingTokens;
declare const JazzMeetingTokens: typeof JazzRoomTokens;
type RoomManagerService = MeetingManagerService;
type MeetingManagerService = RoomManagerService;
type ClientManagerEvent = ClientsManagerEvent;
type ClientsManagerEvent = ClientManagerEvent;
type ClientManagerService = ClientsManagerService;
type ClientsManagerService = ClientManagerService;
/**
* @example b2b_13ne6i_2tm8gv
*/
type RoomId = string;
type RoomSettings = Readonly<{
title?: string;
watermarkEnabled?: boolean;
lobbyEnabled?: boolean;
guestEnabled?: boolean;
sipEnabled?: boolean;
/*
* @deprecated
* в новых версиях бэкенда будет отправляться в featureFlags
*/
jsonChatEnabled?: boolean;
serverVideoRecordAutoStartEnabled?: boolean;
room3dEnabled?: boolean;
room3dScene?: string;
summarizationEnabled?: boolean;
// HACK: Not returned by server
isNext?: boolean;
}>;
type EditableRoomSettings = Readonly<
Partial<
Pick<
RoomSettings,
| 'title'
| 'watermarkEnabled'
| 'lobbyEnabled'
| 'sipEnabled'
| 'serverVideoRecordAutoStartEnabled'
| 'room3dEnabled'
| 'room3dScene'
| 'summarizationEnabled'
>
>
>;
type RoomRestrictions = Readonly<{
asrAllowed?: boolean;
chatAllowed?: boolean;
denoiserAllowed?: boolean;
editOwnNameAllowed?: boolean;
editTitleAllowed?: boolean;
guestAllowed?: boolean;
inviteAllowed?: boolean;
lobbyAllowed?: boolean;
maxConferenceCapacity?: number;
maxConferenceDurationSec?: number;
maxPremiumConferences?: number;
maxUsersForInfiniteConference?: number;
recordScreenAllowed?: boolean;
sipAllowed?: boolean;
watermarkAllowed?: boolean;
webinarAllowed?: boolean;
maxConferenceViewersCapacity?: number;
}>;
declare const USER_PERMISSION: readonly [
'canEditOwnName',
'canEditRoomPolicy',
'canEditRoomTitle',
'canFinishCall',
'canGrantPermission',
'canInvite',
'canKickUser',
'canMuteUser',
'canRequestPermission',
'canSendMessage',
'canShareAudio',
'canShareCamera',
'canShareMedia',
'canViewModerators',
'canViewAsr',
'canManageAsr',
'canManageWatermark',
'canManageLobby',
'canToggleLobby',
'canManageDenoiser',
'canRecordScreen',
'canStartServerVideoRecord',
'canStartPoll',
'canSendReaction',
'canManagePoll',
'canManageSessionGroups',
'canLeaveSessionGroups',
'canViewMessage',
];
type UserPermissionKey = (typeof USER_PERMISSION)[number];
type UserPermissions = Readonly<Record<UserPermissionKey, boolean>>;
type PartialUserPermissions = Partial<UserPermissions>;
type RolePermissions = Readonly<Record<UserRole, PartialUserPermissions>>;
type RoomMuteMediaType = 'audio' | 'video';
type ApiAuthErrorResolution = 'retry' | 'fail';
type AuditUser = Readonly<{
id?: string;
name?: string;
email?: string;
affiliation?: string;
}>;
type EventType = {
type: string;
localizedType?: string;
};
type Event = {
id: string;
timestamp: number;
type: EventType;
params?: string;
room?: {
id: string;
};
user?: AuditUser;
client?: {
id?: string;
type?: string;
};
};
type ConnectionInterruptedReason =
| 'unknown'
| 'iceConnection'
| 'xmppConnection'
| 'jvbConnection';
type AuthStatus = 'anonymous' | 'authorised';
type AuthMethod = StringEnum<'token'>;
type DisplayCaptureMode = 'highQuality' | 'maxFPS';
declare const LOCAL_MEDIA_DEVICE_KIND: {
readonly AUDIO_INPUT: 'audioInput';
readonly AUDIO_OUTPUT: 'audioOutput';
readonly VIDEO_INPUT: 'videoInput';
};
declare const MEDIA_PERMISSION: {
readonly GRANTED: 'granted';
readonly DENIED: 'denied';
readonly PROMPT: 'prompt';
};
declare const DISPLAY_MEDIA_TYPE: {
readonly SCREEN: 'displayScreen';
};
declare const USER_MEDIA_TYPE: {
readonly AUDIO: 'audio';
readonly VIDEO: 'video';
};
type MediaPermission = 'granted' | 'denied' | 'prompt';
type UserMediaType = 'audio' | 'video';
type DisplayMediaType = 'displayScreen';
type MediaType$0 = UserMediaType | DisplayMediaType;
type UserMediaPermissionState = Readonly<
Record<UserMediaType, MediaPermission>
>;
type DisplayMediaPermissionState = Readonly<
Record<DisplayMediaType, MediaPermission>
>;
type GroupedDevices = {
['audioInput']: LocalAudioInputDevice[];
['audioOutput']: LocalAudioOutputDevice[];
['videoInput']: LocalVideoInputDevice[];
};
type LocalMediaDeviceKind = 'audioInput' | 'audioOutput' | 'videoInput';
type LocalMediaDeviceId = string;
type BaseMediaDeviceInfo = {
deviceId: LocalMediaDeviceId;
groupId?: string;
label: string | '';
};
type LocalAudioInputDevice = Readonly<
{
kind: 'audioInput';
} & BaseMediaDeviceInfo
>;
type LocalAudioOutputDevice = Readonly<
{
kind: 'audioOutput';
} & BaseMediaDeviceInfo
>;
type LocalVideoInputDevice = Readonly<
{
kind: 'videoInput';
} & BaseMediaDeviceInfo
>;
type LocalMediaDevice =
| LocalAudioInputDevice
| LocalAudioOutputDevice
| LocalVideoInputDevice;
type MediaPermissionErrorType =
| 'browser' // NotAllowedError - при запрете в окне разрешить / запретить
| 'OS' // NotFoundError - при запрете на уровне операционной системы
| 'unknown';
type MediaPermissionErrorKind = 'audio' | 'video';
type LocalTrackEffect = JitsiLocalTrackEffect;
type JazzVideoResolution = JitsiVideoResolution;
declare class OrderDisplayTrackError extends Error {
constructor();
}
type MediaKind = 'audio' | 'video' | 'desktop';
declare class RequiredDeviceIdError extends Error {
kind: MediaKind;
constructor(kind: MediaKind);
}
declare class ScreenShareUserCanceledError extends Error {
constructor();
}
declare class NotReadableError extends Error {
constructor();
}
declare class DisplayPermissionDeniedError extends Error {
constructor();
}
/**
* Provider of a state value.
*/
type Query$0<T> = RxEffectsQuery<T>;
/**
* Function which unsubscribes from something.
*/
type Unsubscriber = () => void;
/**
* Subscribes a listener on a value of the query and its changes.
* @example
* ```ts
import {
handleQuery,
} from '@salutejs/jazz-sdk-web';
...
const unsubscribe = handleQuery(room.participants, (participants) => {
console.log(participants);
});
unsubscribe()
```
*/
declare function handleQuery<T>(
query: Query$0<T> | Atom<T>,
observer: (value: T) => unknown,
): Unsubscriber;
/**
* Subscribes a listener on changes of the query only.
*
* @example
* ```ts
import {
handleQueryChanges,
} from '@salutejs/jazz-sdk-web';
...
const unsubscribe = handleQueryChanges(room.participants, (participants) => {
console.log(participants);
});
unsubscribe()
```
*/
declare function handleQueryChanges<T>(
query: Query$0<T> | Atom<T>,
listener: (value: T) => unknown,
): Unsubscriber;
/**
* Subscribes a listener on an event bus by type.
*
* @example
* ```ts
import {
handleEvent,
} from '@salutejs/jazz-sdk-web';
...
const unsubscribe = handleEvent(
client.event$,
'addRoom',
async ({ payload }) => {
console.log(payload.room);
},
);
unsubscribe();
```
*/
declare function handleEvent<
Event extends EventLike,
Type extends Event['type'],
TypedEvent extends Event & {
type: Type;
},
>(
eventBus: Observable<Event> | Signal<Event>,
type: Type,
listener: (event: TypedEvent) => unknown,
isOnce?: boolean,
): Unsubscriber;
/**
* Subscribes a listener on an event bus.
*
* @example
* ```ts
import {
handleEvents,
} from '@salutejs/jazz-sdk-web';
...
const unsubscribe = handleEvents(client.event$, (event) => {
if (event.type === 'addRoom') {
console.log(payload.room);
}
});
unsubscribe()
```
*/
declare function handleEvents<Event extends EventLike>(
eventBus: Observable<Event> | Signal<Event>,
listener: (event: Event) => unknown,
isOnce?: boolean,
): Unsubscriber;
declare class JazzRoomError<
T extends JazzRoomErrorReason = JazzRoomErrorReason,
> extends Error {
readonly reason: T;
constructor(message: string, reason: T);
}
declare class AuthorizationRequiredError extends Error {
constructor();
}
declare class RoomConnectedError extends Error {
constructor();
}
declare class PermissionDeniedError extends Error {
constructor(permission: string);
}
type JazzRoomEventLocalParticipantId = Readonly<{
type: 'localParticipantId';
payload: {
participantId: JazzRoomParticipantId;
};
}>;
type JazzRoomEventParticipants = Readonly<{
type: 'participants';
payload: {
participants: JazzRoomParticipant[];
};
}>;
type JazzRoomEventParticipantUpdate = Readonly<{
type: 'participantUpdate';
payload: {
participant: {
id: JazzRoomParticipantId;
} & Partial<Omit<JazzRoomParticipant, 'id'>>;
};
}>;
type JazzRoomEventParticipantLeft = Readonly<{
type: 'participantLeft';
payload: {
participant: JazzRoomParticipant;
};
}>;
type JazzRoomEventParticipantJoined = Readonly<{
type: 'participantJoined';
payload: {
participant: JazzRoomParticipant;
};
}>;
type JazzRoomParticipantRole = StringEnum<'owner' | 'member'>;
type JazzRoomParticipantId = string;
type JazzRoomParticipantCommon = {
id: JazzRoomParticipantId;
name: string;
isGuest: boolean;
role: JazzRoomParticipantRole;
joinedDate: number;
email?: string;
};
type JazzRoomParticipantBotType = string;
type JazzRoomParticipantBotDetails = {
type: JazzRoomParticipantBotType;
};
type JazzRoomParticipantBot = JazzRoomParticipantCommon & {
bot: JazzRoomParticipantBotDetails;
};
type JazzRoomParticipantUser = JazzRoomParticipantCommon & {
bot?: undefined;
};
type JazzRoomParticipant = JazzRoomParticipantBot | JazzRoomParticipantUser;
type JazzRoomStatus = JazzRoomStatusMap[keyof JazzRoomStatusMap];
type JazzRoomStatusMap = {
readonly CONNECTED: 'connected';
readonly CONNECTING: 'connecting';
readonly DISCONNECTING: 'disconnecting';
readonly DISCONNECTED: 'disconnected';
readonly ERROR: 'error';
};
type JazzRoomConnectionStatus =
JazzRoomConnectionStatusMap[keyof JazzRoomConnectionStatusMap];
type JazzRoomConnectionStatusMap = {
readonly CONNECTED: 'connected';
readonly CONNECTING: 'connecting';
readonly DISCONNECTED: 'disconnected';
readonly FAILED: 'failed';
};
type JazzRoomReconnectingReason =
| ConnectionInterruptedReason
| 'errorConferenceRestarted'
| 'suspendDetected'
| 'network';
type JazzRoomAudioSource = 'user' | 'display';
type JazzRoomVideoSource = 'user' | 'display';
/** @deprecated please use width and height */
type JazzRoomQuality = 'high' | 'medium' | 'low';
type JazzRoomVideoQuality = Readonly<{
/** @deprecated please use width and height */
quality?: JazzRoomQuality;
height: number;
width: number;
}>;
type JazzRoomMediaSourceState = Readonly<{
isMuted: boolean;
stream?: MediaStream;
}>;
type JazzRoomAudioSourceState = Readonly<
Record<JazzRoomAudioSource, JazzRoomMediaSourceState | undefined>
>;
type JazzRoomVideoSourceState = Readonly<
Record<JazzRoomVideoSource, JazzRoomMediaSourceState | undefined>
>;
type JazzRoomVideoRequest = Readonly<
{
source: JazzRoomVideoSource;
} & JazzRoomVideoQuality
>;
type JazzRoomSettings = {
title: string;
isGuestEnabled: boolean;
};
type JazzRoomSettingsUpdate = Partial<JazzRoomSettings>;
type JazzRoomSettingsState = {
[key in keyof JazzRoomSettings]: JazzRoomSettings[key] | undefined;
};
type JazzRoomSettingsQueries = {
[key in keyof JazzRoomSettingsState]: Query$0<JazzRoomSettingsState[key]>;
};
type JazzRoomUserPermissionRequest = {
permissionKey: JazzRoomUserPermissionKey;
created: Timestamp;
canRequestAgain: boolean;
};
type JazzRoomUserPermissionKey = UserPermissionKey;
type JazzRoomUserPermissions = UserPermissions;
type JazzRoomPartialUserPermissions = PartialUserPermissions;
type NotAllowedError = {
type: 'notAllowed';
};
type AccessByPermissionError = {
type: 'accessByPermission';
};
type ExceededMaxSdkMeetingsError = {
type: 'exceededMaxSdkMeetings';
};
type NetworkError = {
type: 'network';
};
type OpenConnectionError = {
type: 'openConnection';
};
type RoomNotFoundError = {
type: 'roomNotFound';
};
type RoomNotSupportedByClientError = {
type: 'roomNotSupportedByClientError';
};
type UnauthorizedError = {
type: 'unauthorized';
};
type ForbiddenError = {
type: 'forbidden';
};
type RoomCapacityExceededError$0 = {
type: 'roomCapacityExceeded';
payload: {
roomCapacity?: number;
};
};
type UnknownError = {
type: 'unknown';
};
type JazzRoomErrorReason =
| NotAllowedError
| AccessByPermissionError
| ExceededMaxSdkMeetingsError
| NetworkError
| OpenConnectionError
| RoomNotFoundError
| RoomNotSupportedByClientError
| UnauthorizedError
| ForbiddenError
| RoomCapacityExceededError$0
| UnknownError;
type JazzRoomKickedReason = StringEnum<
| 'callEnded'
| 'kicked'
| 'exceededMaxConferenceCapacity'
| 'exceededMaxConferenceViewersCapacity'
| 'exceededMaxConferenceDuration'
>;
type JazzRoomKickedPayload = {
reason: JazzRoomKickedReason;
};
type JazzRoomEventKicked = {
type: 'kicked';
payload: JazzRoomKickedPayload;
};
type JazzRoomLeaveReason = 'localEnd' | 'callEnd';
type JazzRoomEventLeave = {
type: 'leave';
payload: {
reason: JazzRoomLeaveReason;
};
};
type JazzRoomEventAddTrack = Readonly<{
type: 'addTrack';
payload: {
stream: MediaStream;
mediaType: MediaType$0;
participantId: JazzRoomParticipantId;
isMuted: boolean;
isLocal: boolean;
};
}>;
type JazzRoomEventRemoveTrack = Readonly<{
type: 'removeTrack';
payload: {
stream: MediaStream;
mediaType: MediaType$0;
participantId: JazzRoomParticipantId;
isMuted: boolean;
isLocal: boolean;
};
}>;
type JazzRoomEventTrackMuteChanged = Readonly<{
type: 'trackMuteChanged';
payload: {
isMuted: boolean;
stream: MediaStream;
mediaType: MediaType$0;
participantId: JazzRoomParticipantId;
changedByParticipantId: string;
isLocal: boolean;
};
}>;
type JazzRoomEventTrackMuteChangeRejected = Readonly<{
type: 'trackMuteChangeRejected';
payload: {
stream: MediaStream;
mediaType: MediaType$0;
};
}>;
type JazzRoomEventTrackUpdated = Readonly<{
type: 'trackUpdated';
payload: {
stream: MediaStream;
mediaType: MediaType$0;
participantId: JazzRoomParticipantId;
isMuted: boolean;
isLocal: boolean;
};
}>;
type JazzRoomEventRemoteTrackInfo = Readonly<{
type: 'remoteTrackInfo';
payload: {
participantId: JazzRoomParticipantId;
mediaType: MediaType$0;
isMuted: boolean;
};
}>;
type JazzRoomEventSettingsChanged = Readonly<{
type: 'settingsChanged';
payload: Partial<{
title: string;
isGuestEnabled: boolean;
}>;
}>;
type JazzRoomParamsUpdate = Readonly<{
conferenceId: JazzRoomConferenceId;
conferencePassword: string;
roomId: JazzRoomId;
roomPassword: string;
roomType: JazzRoomType;
nodeUrl: string;
nodeToken: string;
domainUrl: string | undefined;
sessionSecret: string;
}>;
type JazzRoomEventParamsChanged = Readonly<{
type: 'paramsChanged';
payload: JazzRoomParamsUpdate;
}>;
type JazzRoomEventLocalParticipantChanged = Readonly<{
type: 'localParticipantChanged';
payload: {
participant: JazzRoomParticipant;
};
}>;
type JazzRoomEventDominantSpeakerChanged = Readonly<{
type: 'dominantSpeakerChanged';
payload: {
id: JazzRoomParticipantId;
prevId: JazzRoomParticipantId | undefined;
};
}>;
type JazzRoomEventDestroy = Readonly<{
type: 'destroy';
}>;
type JazzRoomEventAccessByPermission = Readonly<{
type: 'accessByPermission';
}>;
type JazzRoomEventStatusChanged = Readonly<{
type: 'statusChanged';
payload:
| {
status: JazzRoomStatusMap['CONNECTING'];
}
| {
status: JazzRoomStatusMap['CONNECTED'];
}
| {
status: JazzRoomStatusMap['DISCONNECTING'];
}
| {
status: JazzRoomStatusMap['DISCONNECTED'];
}
| {
status: JazzRoomStatusMap['ERROR'];
error: JazzRoomErrorReason;
};
}>;
type JazzRoomEventConnecting = Readonly<{
type: 'connecting';
}>;
type JazzRoomEventConnected = Readonly<{
type: 'connected';
payload: {
localParticipantId: JazzRoomParticipantId;
roomId: JazzRoomId;
meetingId: JazzMeetingId;
};
}>;
type JazzRoomEventDisconnecting = Readonly<{
type: 'disconnecting';
}>;
type JazzRoomEventDisconnected = Readonly<{
type: 'disconnected';
}>;
type JazzRoomEventError = Readonly<{
type: 'error';
payload: {
error: JazzRoomErrorReason;
};
}>;
type JazzRoomEventConnectionChanged = Readonly<{
type: 'connectionChanged';
payload:
| {
status: JazzRoomConnectionStatusMap['FAILED'];
reason: string;
}
| {
status: JazzRoomConnectionStatusMap['CONNECTING'];
}
| {
status: JazzRoomConnectionStatusMap['CONNECTED'];
}
| {
status: JazzRoomConnectionStatusMap['DISCONNECTED'];
};
}>;
type JazzRoomEventConnectionFailed = Readonly<{
type: 'connectionFailed';
payload: {
reason: string;
};
}>;
type JazzRoomEventConnectionConnecting = Readonly<{
type: 'connectionConnecting';
}>;
type JazzRoomEventConnectionOpen = Readonly<{
type: 'connectionOpen';
}>;
type JazzRoomEventConnectionDisconnected = Readonly<{
type: 'connectionDisconnected';
}>;
type JazzRoomEventReconnecting = Readonly<{
type: 'reconnecting';
payload: {
reason: JazzRoomReconnectingReason;
};
}>;
type JazzRoomEventConnectionInterrupted = Readonly<{
type: 'connectionInterrupted';
payload: {
reason: ConnectionInterruptedReason;
};
}>;
type JazzRoomEventPermissionGranted = Readonly<{
type: 'permissionGranted';
payload: {
permission: JazzRoomUserPermissionKey;
};
}>;
type JazzRoomEventPermissionDenied = Readonly<{
type: 'permissionDenied';
payload: {
permission: JazzRoomUserPermissionKey;
};
}>;
type JazzRoomEventRolePermissionsChanged = Readonly<{
type: 'rolePermissionsChanged';
payload: {
userRole: JazzRoomParticipantRole;
permissions: PartialUserPermissions;
prevPermissions: PartialUserPermissions;
};
}>;
type JazzRoomEventPermissionRequested = Readonly<{
type: 'permissionRequested';
payload: {
participantId: JazzRoomParticipantId;
permission: JazzRoomUserPermissionKey;
};
}>;
type JazzRoomEvent =
| JazzRoomEventAddTrack
| JazzRoomEventRemoveTrack
| JazzRoomEventTrackMuteChanged
| JazzRoomEventTrackMuteChangeRejected
| JazzRoomEventTrackUpdated
| JazzRoomEventRemoteTrackInfo
| JazzRoomEventSettingsChanged
| JazzRoomEventLocalParticipantId
| JazzRoomEventLocalParticipantChanged
| JazzRoomEventParticipants
| JazzRoomEventParticipantUpdate
| JazzRoomEventParticipantLeft
| JazzRoomEventParticipantJoined
| JazzRoomEventDominantSpeakerChanged
| JazzRoomEventDestroy
| JazzRoomEventAccessByPermission
| JazzRoomEventParamsChanged
| JazzRoomEventKicked
| JazzRoomEventLeave
| JazzRoomEventPermissionGranted
| JazzRoomEventPermissionDenied
| JazzRoomEventRolePermissionsChanged
| JazzRoomEventPermissionRequested
| JazzRoomEventStatusChanged
| JazzRoomEventConnecting
| JazzRoomEventConnected
| JazzRoomEventDisconnecting
| JazzRoomEventDisconnected
| JazzRoomEventError
| JazzRoomEventConnectionChanged
| JazzRoomEventConnectionFailed
| JazzRoomEventConnectionConnecting
| JazzRoomEventConnectionOpen
| JazzRoomEventConnectionDisconnected
| JazzRoomEventReconnecting
| JazzRoomEventConnectionInterrupted;
type JazzRoomSources = ReadonlyMap<MediaType$0, JazzRoomMediaSourceState>;
type JazzRoomConferenceId = ConferenceId;
type JazzRoomId = RoomId;
type JazzMeetingId = RoomId;
type JazzRoomType = StringEnum<'ANONYMOUS' | 'MEETING'>;
type JazzRoomParams = Readonly<{
conferenceId: JazzRoomConferenceId;
conferencePassword: string;
roomId: Query$0<JazzRoomId | undefined>;
roomPassword: Query$0<string | undefined>;
roomType: Query$0<JazzRoomType | undefined>;
nodeUrl: Query$0<string | undefined>;
nodeToken: Query$0<string | undefined>;
domainUrl: Query$0<string | undefined>;
sessionSecret: Query$0<string | undefined>;
}>;
type JazzRoomUserPermissionRequests = ReadonlyMap<
JazzRoomUserPermissionKey,
JazzRoomUserPermissionRequest
>;
type JazzRoomRolePermissions = RolePermissions;
type JazzRoomPermissionRequests = ReadonlyArray<JazzRoomPermissionRequest>;
type JazzRoomPermissionRequestResolutions = ReadonlyMap<
JazzRoomParticipantId,
ReadonlyMap<JazzRoomUserPermissionKey, JazzRoomPermissionRequestResolution>
>;
type JazzRoomGrantedPermissions = ReadonlyMap<
JazzRoomParticipantId,
ReadonlySet<JazzRoomUserPermissionKey>
>;
type JazzRoom = Readonly<{
container: Container;
//
// Room lifecycle
//
event$: Observable<JazzRoomEvent>;
status: Query$0<JazzRoomStatus>;
error: Query$0<JazzRoomErrorReason | undefined>;
connectionStatus: Query$0<JazzRoomConnectionStatus>;
params: JazzRoomParams;
settings: JazzRoomSettingsQueries;
ready: (
status?: 'connected' | 'disconnecting' | 'disconnected',
) => Promise<void>;
leave: (options?: { endConference: boolean }) => Promise<void>;
//
// Participants
//
localParticipant: Query$0<JazzRoomParticipant | undefined>;
remoteParticipants: Query$0<Readonly<JazzRoomParticipant>[]>;
participants: Query$0<Readonly<JazzRoomParticipant>[]>;
dominantParticipantId: Query$0<JazzRoomParticipantId | undefined>;
sources: Query$0<ReadonlyMap<JazzRoomParticipantId, JazzRoomSources>>;
userPermissions: Query$0<JazzRoomUserPermissions>;
userPermissionRequests: Query$0<JazzRoomUserPermissionRequests>;
requestPermission: (permission: JazzRoomUserPermissionKey) => void;
getParticipantSource: (
participantId: JazzRoomParticipantId,
mediaType: MediaType$0,
) => JazzRoomMediaSourceState | undefined;
//
// Local media streams
//
userAudioStream: Query$0<MediaStream | undefined>;
userVideoStream: Query$0<MediaStream | undefined>;
displayStream: Query$0<MediaStream | undefined>;
setUserAudioInput: (stream: MediaStream | undefined) => void;
setUserVideoInput: (stream: MediaStream | undefined) => void;
setDisplayVideoInput: (stream: MediaStream | undefined) => void;
isAudioInputMuted: Query$0<boolean>;
muteAudioInput: (isMuted: boolean) => Promise<void>;
isVideoInputMuted: Query$0<boolean>;
muteVideoInput: (isMuted: boolean) => Promise<void>;
isDisplayVideoInputMuted: Query$0<boolean>;
muteDisplayVideoInput: (isMuted: boolean) => Promise<void>;
displayCaptureMode: Atom<DisplayCaptureMode>;
setDisplayCaptureMode: (mode: DisplayCaptureMode) => void;
//
// Remote media streams
//
getAudioStream: (
participantId: JazzRoomParticipantId,
) => MediaStream | undefined;
getVideoStream: (
participantId: JazzRoomParticipantId,
request: {
source: JazzRoomVideoSource;
},
) => MediaStream | undefined;
getVideoStreamSourceName: (
participantId: JazzRoomParticipantId,
source: JazzRoomVideoSource,
) => string | undefined;
// TODO: Нужно доделать
// releaseMediaStream: (stream: MediaStream) => void;
// releaseMediaStreams: (
// participant: JazzRoomParticipant,
// filter?: { source?: 'user' | 'display'; type?: 'audio' | 'video' },
// ) => void;
// releaseAllMediaStreams: () => void;
moderator: {
permissionRequests: Query$0<JazzRoomPermissionRequests>;
rolePermissions: Query$0<JazzRoomRolePermissions>;
permissionRequestResolutions: Query$0<JazzRoomPermissionRequestResolutions>;
grantedPermissions: Query$0<JazzRoomGrantedPermissions>;
muteUsers: (
participantIds:
| ReadonlyArray<JazzRoomParticipantId>
| JazzRoomParticipantId,
type: RoomMuteMediaType,
) => void;
muteUsersAll: (type: RoomMuteMediaType) => void;
kickUsers: (
participantIds:
| ReadonlyArray<JazzRoomParticipantId>
| JazzRoomParticipantId,
) => void;
kickUsersAll: () => void;
setRolePermissions: (props: {
role: JazzRoomParticipantRole;
permissions: JazzRoomPartialUserPermissions;
}) => Promise<void>;
grantPermission: (
participantId: JazzRoomParticipantId,
permission: JazzRoomUserPermissionKey,
allowed: boolean,
) => void;
removeGrantedPermission: (permission: JazzRoomUserPermissionKey) => void;
setSettings: (settingsUpdate: JazzRoomSettingsUpdate) => Promise<void>;
};
}>;
type JazzRoomPermissionRequest = {
participantId: JazzRoomParticipantId;
created: Timestamp;
permissionKey: JazzRoomUserPermissionKey;
};
type JazzRoomPermissionRequestResolution = {
participantId: JazzRoomParticipantId;
created: Timestamp;
permissionKey: JazzRoomUserPermissionKey;
resolution: boolean;
};
type RoomConnectionEvent =
| JazzRoomEventConnectionChanged
| JazzRoomEventConnectionFailed
| JazzRoomEventConnectionConnecting
| JazzRoomEventConnectionOpen
| JazzRoomEventConnectionDisconnected
| JazzRoomEventConnectionInterrupted
| JazzRoomEventReconnecting
| JazzRoomEventConnecting
| JazzRoomEventAddRoom
| JazzRoomEventRemoveRoom
| JazzRoomEventError;
type JazzRoomEventAddRoom = {
type: 'addRoom';
payload: {
roomConnection: JazzRoomConnection;
room: JazzRoom;
};
};
type JazzRoomEventRemoveRoom = {
type: 'removeRoom';
payload: {
roomConnection: JazzRoomConnection;
room: JazzRoom;
};
};
type JazzRoomConnection = {
roomId: JazzRoomId;
roomPassword: string;
connectionStatus: Query<JazzRoomConnectionStatus>;
container: Container;
event$: Observable<RoomConnectionEvent>;
};
type DisplayInputOptions = {
/**
* Create media stream from device
*/
device?: LocalVideoInputDevice;
};
type AudioInputOptions = {
device: LocalAudioInputDevice;
isMuted?: boolean;
};
type VideoInputOptions = {
device: LocalVideoInputDevice;
isMuted?: boolean;
resolution?: JazzVideoResolution;
frameRate?: number;
};
type GetSelectedAudioInputOptions = {
isMuted?: boolean;
};
type GetSelectedVideoInputOptions = {
isMuted?: boolean;
resolution?: JazzVideoResolution;
frameRate?: number;
};
type MediaKind$0 = 'audio' | 'video';
declare class UserDeniedPermissionError extends Error {
constructor(types: MediaKind$0[]);
}
declare class DevicesNotFoundError extends Error {
kind: MediaKind$0;
constructor(kind: MediaKind$0);
}
/**
* Jazz SDK Plugin provides additional features.
*/
type JazzSdkPlugin<T extends Module<AnyObject> = Module<AnyObject>> = Promise<
() => {
key: string | undefined;
module: JazzSdkModuleDeclaration<T>;
}
>;
type JazzSdkModuleDeclaration<
T extends JazzSdkModule<AnyObject> = JazzSdkModule<AnyObject>,
> = ModuleDeclaration<T>;
type JazzSdkModule<T extends AnyObject = AnyObject> = Module<T>;
type JazzSdkAdditionalPlugins = ReadonlyArray<JazzSdkPlugin>;
type EmptyObject$0 = {
[K in string]: never;
};
type ValuesProps = AnyObject;
type JazzSdkModuleFactoryProps<
Props extends ValuesProps | EmptyObject$0 | undefined,
Name extends string | undefined = undefined,
> = (Props extends undefined | EmptyObject$0
? {
container: Container;
scope: Scope$0;
}
: {
container: Container;
deps: Props;
scope: Scope$0;
}) &
(Name extends undefined
? // eslint-disable-next-line @typescript-eslint/ban-types
{}
: {
name: Name;
});
type JazzSdkModuleFactory<
T extends Module<ValuesProps>,
Deps extends ValuesProps | EmptyObject$0 | undefined,
Name extends string | undefined,
> = (props: JazzSdkModuleFactoryProps<Deps, Name>) => T;
type JazzSdkEventAddClient = Readonly<{
type: 'addClient';
payload: {
client: JazzClient;
};
}>;
type JazzSdkEventRemoveClient = Readonly<{
type: 'removeClient';
payload: {
client: JazzClient;
};
}>;
type JazzSdkEventAddRoom = Readonly<{
type: 'addRoom';
payload: {
client: JazzClient;
room: JazzRoom;
};
}>;
type JazzSdkEventRemoveRoom = Readonly<{
type: 'removeRoom';
payload: {
client: JazzClient;
room: JazzRoom;
};
}>;
type JazzSdkEvent =
| JazzSdkEventAddClient
| JazzSdkEventRemoveClient
| JazzSdkEventAddRoom
| JazzSdkEventRemoveRoom;
/**
* Jazz SDK provides a common runtime for Jazz Clients and Plugins
*/
type JazzSdk = Controller<{
container: Container;
event$: Observable<JazzSdkEvent>;
}>;
type JazzSdkOptions = Readonly<{
/** Extensions for the SDK */
plugins?: JazzSdkAdditionalPlugins;
/** Custom ID to identify an application which uses the SDK. */
userAgent?: string;
/**
* Custom storage for persisting data between sessions.
* By default, a platform-specific storage is used.
* Pass 'in-memory' value to force using an in-memory storage.
*/
localStorage?: KeyValueStorage | 'in-memory';
/**
* Custom storage to persist data during a user session.
* By default, a platform-specific storage is used.
* Pass 'in-memory' value to force using an in-memory storage.
*/
sessionStorage?: KeyValueStorage | 'in-memory';
/**
* Custom DI container for low-level SDK setup.
*/
container?: Container;
/**
* Key-value flags to low-level SDK setup.
*/
configFlags?: Readonly<Record<string, string>>;
/**
* Initial audio input deviceId
*/
audioInputDeviceId?: string | undefined;
/**
* Initial audio output deviceId
*/
audioOutputDeviceId?: string | undefined;
/**
* Initial video input deviceId
*/
videoInputDeviceId?: string | undefined;
/**
* Mod of the audio input switching strategy.
* - 'new-prefer' - automatic selection of the added device
* - 'manual' - the device does not switch when adding a new device
* @default 'new-prefer'
*/
audioInputSwitchingMode?: SwitchingMode;
/**
* Mod of the audio output switching strategy.
* - 'new-prefer' - automatic selection of the added device
* - 'manual' - the device does not switch when adding a new device
* @default 'new-prefer'
*/
audioOutputSwitchingMode?: SwitchingMode;
/**
* Mod of the video input switching strategy.
* - 'new-prefer' - automatic selection of the added device
* - 'manual' - the device does not switch when adding a new device
* @default 'new-prefer'
*/
videoInputSwitchingMode?: SwitchingMode;
}>;
type SwitchingMode = 'new-prefer' | 'manual';
declare function createJazzClient(
sdk: JazzSdk | JazzClient,
options: JazzClientOptions,
): Promise<JazzClient>;
/**
* Manager of conferences
*/
type JazzSdkConferenceManager = Readonly<{
/**
* Connects to a conference room
*/
join: (params: { conferenceId: string; password: string }) => JazzRoom;
/**
* Gets details about a conference
*/
getDetails: (
params: JazzSdkRoomDetailsParams,
) => Promise<JazzSdkConferenceRoomDetails>;
/**
* Creates a conference for authorised users.
*
* Use the "guestEnabled" parameter to allow anonymous participants
* to join the conference.
*/
createConference: (
params: JazzSdkCreateConferenceParams,
) => Promise<JazzSdkCreateConferenceResult>;
/**
* Updates the conference settings.
*/
update: (params: {
conferenceId: string;
password: string;
roomSettings: EditableRoomSettings;
}) => Promise<void>;
/**
* Closes the conference to connect.
*/
close: (params: { conferenceId: string; password: string }) => Promise<void>;
}>;
type JazzSdkRoomDetails = Readonly<{
roomType: StringEnum<'MEETING'>;
userRole: JazzRoomParticipantRole;
roomTitle?: string;
roomRestrictions?: JazzClientRoomRestrictions;
}>;
type JazzClientRoomRestrictions = RoomRestrictions;
type JazzSdkGetRoomDetailsError =
| {
type: 'notFound';
}
| {
type: 'unauthorised';
}
| {
type: 'unknown';
}
| {
type: 'accessDenied';
}
| {
type: 'httpClientError';
}
| {
type: 'invalidState';
};
type JazzSdkConferenceRoomDetails = JazzSdkRoomDetails;
type JazzSdkCreateAnonymousRoomParams = Readonly<{
title: string;
}>;
// TODO: нужно разобраться с ошибками при создании комнаты
type JazzSdkCreateAnonymousRoomError = {
type: 'unknown';
};
type JazzSdkCreateAnonymousRoomDetails = Readonly<{
id: string;
roomTitle: string;
roomType: StringEnum<'ANONYMOUS'>;
password: string;
url: string;
}>;
type JazzSdkCreateAnonymousRoomResult = JazzSdkCreateAnonymousRoomDetails;
type JazzSdkCreateConferenceParams = Readonly<{
title: string;
isGuestEnabled?: boolean;
isLobbyEnabled?: boolean;
jazzNextOnly?: boolean;
roomType?: JazzRoomType;
}>;
// TODO: нужно разобраться с ошибками при создании комнаты
type JazzSdkCreateConferenceError = {
type: 'unknown';
};
type JazzSdkCreateConferenceDetails = Readonly<{
id: string;
roomTitle: string;
roomType: StringEnum<'MEETING'>;
password: string;
url: string;
}>;
type JazzSdkCreateConferenceResult = JazzSdkCreateConferenceDetails;
type JazzSdkRoomDetailsParams = Readonly<{
conferenceId: string;
password: string;
}>;
type SdkTokenOptions = {
/**
* Уникальный идентификатор запроса от клиента к серверу
* @example beaff5c1-644c-413f-ba76-a583d892b5a4
*/
requestId?: string;
/**
* Время в секундах через которое истечет срок жизни токена
* @default 120
*/
expireIn?: number;
/**
* Название компании или проекта используется в логах
* Есть ограничение в 100 символов
*/
iss?: string;
/**
* Идентификатор пользователя
*/
sub: string;
/**
* Имя пользователя
*/
userName?: string;
/**
* Почта пользователя
*/
userEmail?: string;
};
/**
*
* @param secret base64 строка
* @param options настройки окружения
*
* @returns {Promise} токен доступа
*/
declare function createSdkToken(
secret: string,
options: SdkTokenOptions,
): Promise<{
sdkToken: string;
}>;
type JazzSdkUserInfoAuthType = StringEnum<'SDK'>;
type JazzSdkAuthStatus = 'authorised' | 'anonymous' | 'pending';
type JazzSdkAuthMethod = AuthMethod;
type JazzSdkUserInfoAuthError =
| 'OK'
| 'AUTH_TYPE_MISMATCH'
| 'TOKEN_EXPIRED'
| 'TOKEN_INVALID'
| 'TOKEN_MISSING';
type JazzSdkAuthEvent =
| {
type: 'authorised';
payload: Readonly<{
authMethod: AuthMethod;
userInfo: JazzSdkUserInfo;
}>;
}
| {
type: 'loginStarted';
payload: Readonly<{
authMethod: AuthMethod;
}>;
}
| {
type: 'loginFailed';
payload: Readonly<{
authMethod: AuthMethod;
}>;
}
| {
type: 'loggedOut';
payload: Readonly<{
authMethod?: AuthMethod;
authStatus: AuthStatus;
userInfo?: JazzSdkUserInfo;
}>;
}
| {
type: 'invalidToken';
}
| {
type: 'unauthorisedError';
};
type JazzSdkUserInfoServerFeatures = Readonly<{
maxConferenceDuration?: number;
maxConferenceCapacity?: number;
maxUsersForInfiniteConference?: number;
lobbyAvailable?: boolean;
}>;
type JazzSdkUserInfo = Readonly<{
authType?: JazzSdkUserInfoAuthType;
authErr?: JazzSdkUserInfoAuthError;
name?: string;
email?: string;
features?: JazzSdkUserInfoServerFeatures;
}>;
/**
* Jazz SDK authorisation service
*/
type JazzSdkAuthService = Readonly<{
/** Authorisation event bus */
event$: Observable<JazzSdkAuthEvent>;
/** Authorisation status */
authStatus: Query$0<JazzSdkAuthStatus>;
/** Authorisation method */
authMethod: Query$0<JazzSdkAuthMethod | undefined>;
/** Authorised user flag */
isAuthorised: Query$0<boolean>;
/**
* Info about the current user.
* Data can be retrieved for both authorised and anonymous users.
*/
userInfo: Query$0<JazzSdkUserInfo | undefined>;
/**
* Authenticates by an SDK token
*
* @return JazzSdkUserInfo if a user is authorised
*/
loginBySdkToken: (sdkToken: string) => Promise<JazzSdkUserInfo>;
/**
* Authenticates by a low-level auth-token
*
* @return `true` if a user is authorised
*/
setAuthToken: (authToken: string) => Promise<boolean>;
/** Discards a current user session */
logout: () => Promise<void>;
}>;
declare function getJazzClient(jazzRoom: JazzRoom): JazzClient;
// TODO: experimental change from Query to Atom through an intermediate step QueryAtom
/**
* type Query is deprecated, the name of the future reactive data is Atom
*/
type QueryAtom<T> = Atom<T> & Query<T>;
type JazzClientEventAddRoomConnection = {
type: 'addRoomConnection';
payload: {
roomConnection: JazzRoomConnection;
};
};
type JazzClientEventRemoveRoomConnection = {
type: 'removeRoomConnection';
payload: {
roomConnection: JazzRoomConnection;
};
};
type JazzClientEventAddRoom = {
type: 'addRoom';
payload: {
room: JazzRoom;
};
};
type JazzClientEventRemoveRoom = {
type: 'removeRoom';
payload: {
room: JazzRoom;
};
};
type JazzClientEventDestroy = {
type: 'destroy';
};
type JazzClientEvent =
| JazzClientEventAddRoom
| JazzClientEventRemoveRoom
| JazzClientEventDestroy
| JazzClientEventAddRoomConnection
| JazzClientEventRemoveRoomConnection;
/**
* JazzClient is a client for the Jazz server
*/
type JazzClient = Readonly<{
container: Container;
/** Server URL which is used by the client */
serverUrl: string;
/** Authorization service to manage a user session */
auth: JazzSdkAuthService;
/** Manager of conferences */
conferences: JazzSdkConferenceManager;
event$: Observable<JazzClientEvent>;
sdk: JazzSdk;
/**
* @deprecated
*/
isNetworkOnline: QueryAtom<boolean>;
destroy: () => void;
}>;
/** Options for `createJazzClient()` factory */
type JazzClientOptions = Readonly<{
/**
* Jazz server URL
*/
serverUrl: string;
/**
* Provider for working with authorization
*/
authProvider?: JazzSdkAuthProvider;
}>;
type JazzSdkAuthProvider = {
/**
* 401 error handler
*/
handleUnauthorizedError?: (
context: JazzSdkAuthService,
) => Promise<ApiAuthErrorResolution>;
/**
* 403 error handler
*/
handleAuthorizationInvalidError?: (
context: JazzSdkAuthService,
) => Promise<ApiAuthErrorResolution>;
};
type LocalDevicesEventAddTrack = Readonly<{
type: 'addTrack';
payload: {
stream: MediaStream;
mediaType: MediaType$0;
isMuted: boolean;
};
}>;
type LocalDevicesEventRemoveTrack = Readonly<{
type: 'removeTrack';
payload: {
stream: MediaStream;
mediaType: MediaType$0;
};
}>;
type LocalDevicesEventDisposeTrack = Readonly<{
type: 'disposeTrack';
payload: {
stream: MediaStream;
mediaType: MediaType$0;
};
}>;
type LocalDevicesEventMuteTrackChanged = Readonly<{
type: 'muteTrackChanged';
payload: {
stream: MediaStream;
mediaType: MediaType$0;
isMuted: boolean;
};
}>;
type LocalDevicesEventLocalTrackUpdated = Readonly<{
type: 'localTrackUpdated';
payload: {
stream: MediaStream;
mediaType: MediaType$0;
isMuted: boolean;
};
}>;
type LocalDevicesEventMixDisplayAudio = Readonly<{
type: 'mixDisplayAudio';
payload: {
enabled: boolean;
stream: MediaStream;
};
}>;
type LocalDevicesEventAudioAGCChanged = Readonly<{
type: 'audioAGCChanged';
payload: {
isEnabled: boolean;
};
}>;
type LocalDevicesEventAudioInputChanged = Readonly<{
type: 'audioInputChanged';
payload: {
device: LocalAudioInputDevice;
prevDevice: LocalAudioInputDevice | undefined;
};
}>;
type LocalDevicesEventVideoInputChanged = Readonly<{
type: 'videoInputChanged';
payload: {
device: LocalVideoInputDevice;
prevDevice: LocalVideoInputDevice | undefined;
};
}>;
type LocalDevicesEventAudioOutputChanged = Readonly<{
type: 'audioOutputChanged';
payload: {
device: LocalAudioOutputDevice;
prevDevice: LocalAudioOutputDevice | undefined;
};
}>;
type LocalDevicesEventMediaDevicesChanged = Readonly<{
type: 'mediaDevicesChanged';
payload: {
devices: ReadonlyArray<LocalMediaDevice>;
groupedDevices: GroupedDevices;
added: ReadonlyArray<LocalMediaDevice>;
removed: ReadonlyArray<LocalMediaDevice>;
groupedAddedDevices: GroupedDevices;
groupedRemovedDevices: GroupedDevices;
};
}>;
type LocalDevicesEventPermissionsChanged = Readonly<{
type: 'permissionsChanged';
payload: UserMediaPermissionState;
}>;
type LocalDevicesEventErrorDevicePermissions = Readonly<{
type: 'errorDevicePermissions';
payload: {
type: MediaPermissionErrorType;
kind: MediaPermissionErrorKind[];
message: string;
};
}>;
type LocalDevicesEventRequestDevicePermissions = {
type: 'requestDevicePermissions';
payload: {
mediaTypes: UserMediaType[];
};
};
type LocalDevicesEventSuccessDevicePermissions = {
type: 'successDevicePermissions';
payload: {
mediaTypes: UserMediaType[];
state: UserMediaPermissionState;
};
};
type LocalDevicesEvent =
| LocalDevicesEventAddTrack
| LocalDevicesEventRemoveTrack
| LocalDevicesEventDisposeTrack
| LocalDevicesEventMuteTrackChanged
| LocalDevicesEventLocalTrackUpdated
| LocalDevicesEventMixDisplayAudio
| LocalDevicesEventAudioAGCChanged
| LocalDevicesEventAudioAGCChanged
| LocalDevicesEventAudioInputChanged
| LocalDevicesEventVideoInputChanged
| LocalDevicesEventAudioOutputChanged
| LocalDevicesEventMediaDevicesChanged
| LocalDevicesEventPermissionsChanged
| LocalDevicesEventErrorDevicePermissions
| LocalDevicesEventRequestDevicePermissions
| LocalDevicesEventSuccessDevicePermissions;
type LocalDevicesMediaStreamState = {
isMuted: Query<boolean>;
mute: (isMuted: boolean) => Promise<void>;
deviceId: string;
};
/**
* Managed of local media devices.
*/
type LocalDevicesManager = {
/** Local device event bus */
event$: Observable<LocalDevicesEvent>;
/** Checking support for display media */
// supportsGetDisplayMedia: () => boolean;
//
// Permissions
//
/** Permissions for user media devices */
userMediaPermissions: Query<UserMediaPermissionState>;
/** Permissions for display media devices */
// displayMediaPermissions: Query<DisplayMediaPermissionState>;
/** Request a permission to use user media devices */
requestUserMediaPermissions: (
...types: UserMediaType[]
) => Promise<UserMediaPermissionState>;
/** Request a permission to use display media devices */
// requestDisplayMediaPermissions: (
// ...types: DisplayMediaType[]
// ) => Promise<DisplayMediaPermissionState>;
//
// Devices
//
// Queries
/** Available audio inputs */
audioInputDevices: Query<ReadonlyArray<LocalAudioInputDevice>>;
/** Available audio outputs */
audioOutputDevices: Query<ReadonlyArray<LocalAudioOutputDevice>>;
/** Available video inputs */
videoInputDevices: Query<ReadonlyArray<LocalVideoInputDevice>>;
/** Current audio input for general use in conferences. */
audioInput: Query<LocalAudioInputDevice | undefined>;
/** Current audio output for general use in conferences. */
audioOutput: Query<LocalAudioOutputDevice | undefined>;
/** Current video input for general use in conferences. */
videoInput: Query<LocalVideoInputDevice | undefined>;
// Methods
/** Selects the current audio input.
*
* @example
* ```ts
* try {
* selectAudioInput(device)
* } catch(e) {
* if (e instanceof UserDeniedPermissionError) {
*
* }
* if (e instanceof DevicesNotFoundError) {
*
* }
* }
* ```
*/
selectAudioInput: (device: LocalAudioInputDevice) => Promise<void>;
/** Selects the current audio output.
*
* @example
* ```ts
* try {
* selectAudioOutput(device)
* } catch(e) {
* if (e instanceof DevicesNotFoundError) {
*
* }
* }
* ```
*/
selectAudioOutput: (device: LocalAudioOutputDevice) => Promise<void>;
/** Selects the current video input.
*
* @example
* ```ts
* try {
* selectVideoInput(device)
* } catch(e) {
* if (e instanceof UserDeniedPermissionError) {
*
* }
* if (e instanceof DevicesNotFoundError) {
*
* }
* }
* ```
*/
selectVideoInput: (device: LocalVideoInputDevice) => Promise<void>;
/** Mute and unmute the current audio input. */
muteAllAudioInput: (isMuted: boolean) => Promise<void>;
/** Mute and unmute the current video input. */
muteAllVideoInput: (isMuted: boolean) => Promise<void>;
/** Mute and unmute the current audio input. */
muteAudioInput: (stream: MediaStream, isMuted: boolean) => Promise<void>;
/** Mute and unmute the current video input. */
muteVideoInput: (stream: MediaStream, isMuted: boolean) => Promise<void>;
//
// Media streams
//
/**
* Returns MediaStream which represents a current audio input.
*
* If the current audio input is changed the MediaStream remains the same,
* only its tracks are replaced.
*
* @default options.isMuted = true
*/
getSelectedAudioInputStream: (
options?: GetSelectedAudioInputOptions,
) => Promise<MediaStream>;
/**
* Returns MediaStream which represents a current video input.
*
* If the current video input is changed the MediaStream remains the same,
* only its tracks are replaced.
*
* @default options.isMuted = true
*/
getSelectedVideoInputStream: (
options?: GetSelectedVideoInputOptions,
) => Promise<MediaStream>;
/**
* Returns MediaStream of a provided local audio input.
*/
getAudioInputStream: (options: AudioInputOptions) => Promise<MediaStream>;
/**
* Returns MediaStream of a provided local video input.
*/
getVideoInputStream: (options: VideoInputOptions) => Promise<MediaStream>;
/**
* Returns audio and video streams of a local display media if they are available.
*/
getDisplayInputStream: (
options?: DisplayInputOptions,
) => Promise<MediaStream>;
/**
* Releasing an unused media stream.
*/
releaseMediaStream: (stream: MediaStream) => Promise<void>;
getMediaStreamManager: (stream: MediaStream) => {
$isMuted: Query<boolean>;
mute: (isMuted: boolean) => Promise<void>;
};
getMediaStreamState: (stream: MediaStream) => LocalDevicesMediaStreamState;
isEnableAudioAGC: Query<boolean>;
setAudioAGC: (enabled: boolean) => void;
audioInputSwitchingMode: Query<SwitchingMode>;
setAudioInputSwitchingMode: (mode: SwitchingMode) => void;
videoInputSwitchingMode: Query<SwitchingMode>;
setVideoInputSwitchingMode: (mode: SwitchingMode) => void;
audioOutputSwitchingMode: Query<SwitchingMode>;
setAudioOutputSwitchingMode: (mode: SwitchingMode) => void;
setEffect: (
stream: MediaStream,
effect: LocalTrackEffect | undefined,
) => Promise<void>;
};
type LocalDeviceManagerService = {
localDevices: LocalDevicesManager;
};
type LocalDeviceManagerPlugin = {
localDeviceManager: LocalDeviceManagerService;
};
declare function localDeviceManagerPlugin(): JazzSdkPlugin<LocalDeviceManagerPlugin>;
/**
* Returns the instance of LocalDeviceManager.
*/
declare function getLocalDevices(
sdk: JazzSdk | JazzRoom | JazzClient,
): LocalDevicesManager;
type DisplayEndpointsManager = {
getDisplayEndpointsManager: (room: JazzRoom) => DisplayEndpointsService;
releaseDisplayEndpoints: (room: JazzRoom) => void;
};
type RegisterId = symbol;
type Unsubscribe$0 = () => void;
type RegisterInfo = Readonly<{
id: RegisterId;
unregister: Unsubscribe$0;
}>;
type DisplayEndpointsService =