@simplito/privmx-webendpoint
Version:
PrivMX Web Endpoint library
256 lines (255 loc) • 5.98 kB
TypeScript
export type SessionId = string & {
_sessionId: never;
};
export type TransactionId = string & {
_transactionId: never;
};
export type PluginHandleId = number & {
_pluginHandleId: never;
};
export type PluginId = string & {
_pluginId: never;
};
export type UserToken = string & {
_userToken: never;
};
export type VideoRoomRequestStatus = string & {
_videoRoomStatus: never;
};
export type VideoRoomId = number & {
_videoRoomId: never;
};
export type VideoRoomParticipantId = number & {
_videoRoomParticipantId: never;
};
export type VideoRoomPublisherId = number & {
_videoRoomPublisherId: never;
};
export interface JanusSession {
id: SessionId;
}
export interface JanusStreamInfo {
type: "audio" | "video" | "data";
active: boolean;
mid: string;
mindex: number;
ready: boolean;
send: boolean;
source_ids: VideoRoomParticipantId[];
sources: number;
}
export interface JanusPluginHandle {
id: PluginHandleId;
pluginId: PluginId;
}
export interface VideoRoom {
room: VideoRoomId;
description: string;
pin_required: boolean;
is_private: boolean;
max_publishers: number;
bitrate: number;
bitrate_cap: number;
fir_freq: number;
require_pvtid: boolean;
require_e2ee: boolean;
dummy_publisher: boolean;
notify_joining: boolean;
audiocodec: string;
videocodec: string;
opus_fec: boolean;
opus_dtx: boolean;
record: boolean;
rec_dir: string;
lock_record: boolean;
num_participants: number;
audiolevel_ext: boolean;
audiolevel_event: boolean;
audio_active_packets: number;
audio_level_average: number;
videoorient_ext: boolean;
playoutdelay_ext: boolean;
transport_wide_cc_ext: boolean;
}
export interface PublisherInfo {
id: string;
display: string;
dummy: boolean;
streams: StreamInfo[];
talking: boolean;
}
export interface StreamInfo {
type: string;
mindex: string;
mid: string;
disabled: boolean;
codec: string;
description: string;
moderated: boolean;
simulcast: boolean;
svc: boolean;
talking: boolean;
}
export interface VideoRoomParticipant {
id: VideoRoomParticipantId;
display: string;
publisher: boolean;
talking: boolean;
}
export interface CreateRoomOptions {
room?: string;
permanent?: boolean;
description?: string;
secret?: string;
pin?: string;
is_private?: boolean;
allowed?: UserToken[];
publishers?: number;
}
export interface CreateRoomResult {
videoroom: "created";
room: VideoRoomId;
permanent: boolean;
}
export interface EditRoomOptions {
room: VideoRoomId;
new_description?: string;
}
export interface EditRoomResult {
videoroom: "edited";
room: VideoRoomId;
permanent: boolean;
}
export interface DestroyRoomOptions {
room: VideoRoomId;
secret?: string;
permanent?: boolean;
}
export interface DestroyRoomResult {
videoroom: "destroyed";
room: VideoRoomId;
permanent: boolean;
}
export interface RoomExistsOptions {
room: VideoRoomId;
}
export interface RoomExistsResult {
room: VideoRoomId;
exists: boolean;
}
export interface SetRoomRestrictedAccessOptions {
secret?: string;
action: "enable" | "disable";
room: VideoRoomId;
}
export interface SetRoomAccessAllowedOptions {
secret?: string;
action: "add" | "remove";
room: VideoRoomId;
allowed: string[];
}
export interface RoomAccessResult {
room: VideoRoomId;
allowed?: string[];
}
export interface RoomKickOptions {
secret?: string;
room: VideoRoomId;
id: VideoRoomParticipantId;
}
export interface RoomModerateOptions {
secret?: string;
room: VideoRoomId;
id: VideoRoomParticipantId;
mid: string;
mute: boolean;
}
export interface RoomListParticipantsOptions {
room: VideoRoomId;
}
export interface RoomListResult {
list: VideoRoom[];
}
export interface RoomListParticipantsResult {
room: VideoRoomId;
participants: VideoRoomParticipant[];
}
export interface RoomJoinAsPublisherOptions {
room: VideoRoomId;
id?: VideoRoomParticipantId;
display?: string;
token?: string;
}
export interface RoomJoinAsSubscriberOptions {
room: VideoRoomId;
use_msid?: boolean;
autoupdate?: boolean;
private_id?: string;
streams: RoomJoinStreamOptions[];
data: boolean;
}
export interface RoomJoinStreamOptions {
feed: number;
mid?: string;
crossrefid?: string;
}
export interface VideoRoomDescription {
mid: string;
description?: string;
}
export interface RoomPublishOptions {
videocodec?: string;
bitrate?: number;
record?: boolean;
filename?: string;
display?: string;
audio_level_average?: number;
audio_active_packets?: any;
descriptions?: VideoRoomDescription[];
e2ee?: boolean;
data: boolean;
}
export interface VideoRoomStreamTrack {
type: string;
codec: string;
mid: string;
mindex: number;
}
export interface NewPublisherEvent {
id: VideoRoomPublisherId;
video_codec: string;
streams: VideoRoomStreamTrack[];
}
export interface JoinedEvent {
room: VideoRoomId;
description: string;
id: number;
private_id: number;
publishers: NewPublisherEvent[];
}
export type MediaServerSignallingEvent = WebRTCMediaEvent | WebRTCSHangupEvent | WebRTCSlowLinkEvent | WebRTCUpEvent;
export interface WebRTCUpEvent {
eventType: "webrtcup";
session_id: string;
sender: string;
}
export interface WebRTCMediaEvent {
eventType: "media";
session_id: string;
sender: string;
type: "audio" | "video" | "data";
receiving: boolean;
}
export interface WebRTCSlowLinkEvent {
eventType: "slowlink";
session_id: string;
sender: string;
uplink: boolean;
nacks: number;
}
export interface WebRTCSHangupEvent {
eventType: "hangup";
session_id: string;
sender: string;
reason: string;
}