Skip to content

Commit c6b21fc

Browse files
committed
1.6.0-beta
1 parent cf677fa commit c6b21fc

File tree

6 files changed

+232
-8
lines changed

6 files changed

+232
-8
lines changed

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# Change Log
22

3+
### 1.6.0-beta (Feb 17, 2021 UTC)
4+
Sendbird Calls SDK version 1.6.0 supports the early access program for group calling. New concepts introduced in this version center around *rooms* and *participants*.
5+
* Added group call feature.
6+
* Below methods are added in `SendBirdCall`
7+
* `createRoom(): Promise<Room>`
8+
* `getCachedRoomById(roomId: string): Room`
9+
* `fetchRoomById(roomId: string): Promise<Room>`
10+
* Below class is added in `SendBirdCall`
11+
* `Room`
12+
* Below interfaces are added in `SendBirdCall`
13+
* `EnterParams`
14+
* `Participant`
15+
* `LocalParticipant`
16+
* `RemoteParticipant`
17+
* Below enum is added in `SendBirdCall`
18+
* `ParticipantState`
19+
320
### 1.5.3 (Jan 26, 2021 UTC)
421
* Bug fix
522
* Fixed doubling bug in recording.

SendBirdCall.min.d.ts

Lines changed: 210 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
/** 1.5.3 */
2-
3-
// eslint-disable-next-line no-undef
1+
/** 1.6.0-beta */
2+
// eslint-disable-next-line no-undef,max-classes-per-file
43
export as namespace SendBirdCall;
54

65
export function init(appId: string): void;
@@ -37,6 +36,9 @@ export function handleWebhookData(data: WebhookData): void;
3736
export function addDirectCallSound(type: SoundType, url: string): Promise<boolean>;
3837
export function removeDirectCallSound(type: SoundType): boolean;
3938
export function getCall(callId: string): DirectCall;
39+
export function createRoom(): Promise<Room>;
40+
export function getCachedRoomById(roomId: string): Room;
41+
export function fetchRoomById(roomId: string): Promise<Room>;
4042
export const sdkVersion: string;
4143
export const appId: string;
4244
export const currentUser: User;
@@ -146,6 +148,64 @@ export interface SendBirdCallRecordingListener {
146148
onRecordingFailed: ((callId: string, recordingId: string, error) => void) | null;
147149
}
148150

151+
/**
152+
* Event Target
153+
*/
154+
155+
interface Event {
156+
readonly args?: any[];
157+
}
158+
159+
declare type nullish = null | undefined;
160+
161+
declare type ArgsType<T extends Event> = T['args'] extends nullish ? [] : T['args'];
162+
163+
interface EventListener<T extends Event> {
164+
(...args: ArgsType<T>): void;
165+
}
166+
167+
declare type EventMap = Record<string, Event>;
168+
169+
declare type EventKey<T extends EventMap> = keyof T;
170+
171+
declare class EventTarget<T extends EventMap> {
172+
173+
/**
174+
* Adds a listener to receive events.
175+
*/
176+
addEventListener<K extends EventKey<T>>(type: K, callback: EventListener<T[K]>): void;
177+
178+
/**
179+
* Alias for addEventListener
180+
*/
181+
on: <K extends keyof T>(type: K, callback: EventListener<T[K]>) => void;
182+
183+
/**
184+
* Adds listener to receive events once.
185+
*/
186+
once<K extends EventKey<T>>(type: K, givenCb: EventListener<T[K]>): void;
187+
188+
/**
189+
* Removes an added listener.
190+
*/
191+
removeEventListener<K extends EventKey<T>>(type: K, callback: EventListener<T[K]>): void;
192+
193+
/**
194+
* Alias for removeEventListener
195+
*/
196+
off: <K extends keyof T>(type: K, callback: EventListener<T[K]>) => void;
197+
198+
/**
199+
* Removes all added listeners.
200+
*/
201+
removeAllEventListeners(): void;
202+
203+
}
204+
205+
/**
206+
* DirectCall
207+
*/
208+
149209
export interface DirectCall {
150210
onEstablished: ((call: DirectCall) => void) | null;
151211
onConnected: ((call: DirectCall) => void) | null;
@@ -338,3 +398,150 @@ export interface WebhookData {
338398
[key: string]: any;
339399
}
340400
/* eslint-enable babel/camelcase */
401+
402+
403+
/**
404+
* Room
405+
*/
406+
407+
declare type RoomEventMap = {
408+
remoteParticipantEntered: { args: [RemoteParticipant]; };
409+
remoteParticipantExited: { args: [RemoteParticipant]; };
410+
remoteParticipantStreamStarted: { args: [RemoteParticipant]; };
411+
remoteAudioSettingsChanged: { args: [RemoteParticipant]; };
412+
remoteVideoSettingsChanged: { args: [RemoteParticipant]; };
413+
error: { args: [Error, Particpant?] };
414+
};
415+
416+
/**
417+
* Called when remote participant has been entered
418+
*/
419+
export type RemoteParticipantEnteredEventListener = (participant: RemoteParticipant) => void;
420+
/**
421+
* Called when remote participant has been exited
422+
*/
423+
export type RemoteParticipantExitedEventListener = (participant: RemoteParticipant) => void;
424+
/**
425+
* Called when it's able to receive media stream from remote participant.
426+
*/
427+
export type RemoteParticipantStreamStartedEventListener = (participant: RemoteParticipant) => void;
428+
/**
429+
* Called when audio settings of remote participant has been changed
430+
*/
431+
export type RemoteAudioSettingsChangedEventListener = (participant: RemoteParticipant) => void;
432+
/**
433+
* Called when video settings of remote participant has been changed.
434+
*/
435+
export type RemoteVideoSettingsChangedEventListener = (participant: RemoteParticipant) => void;
436+
437+
export declare class Room extends EventTarget<RoomEventMap> {
438+
439+
/**
440+
* The ID of room
441+
*/
442+
readonly roomId: string;
443+
444+
/**
445+
* Long value of the date when the room created at.
446+
*/
447+
readonly createdAt: number;
448+
449+
/**
450+
* The ID of user who created the room
451+
*/
452+
readonly createdBy: string;
453+
454+
/**
455+
* The list of all participants including local participant.
456+
*/
457+
readonly participants: Participant[];
458+
459+
/**
460+
* The local participant.
461+
*/
462+
readonly localParticipant: LocalParticipant;
463+
464+
/**
465+
* The list of remote participants.
466+
*/
467+
readonly remoteParticipants: RemoteParticipant[];
468+
469+
/**
470+
* Enters a room
471+
*/
472+
enter(params: EnterParams): Promise<void>;
473+
474+
/**
475+
* Exits a room
476+
*/
477+
exit(): Promise<void>;
478+
479+
}
480+
481+
export interface EnterParams {
482+
audioEnabled: boolean;
483+
videoEnabled: boolean;
484+
}
485+
486+
export enum ParticipantState {
487+
/**
488+
* The state when the participant has entered room
489+
*/
490+
ENTERED = 'entered',
491+
/**
492+
* The state when the participant has been connected.
493+
*/
494+
CONNECTED = 'connected',
495+
/**
496+
* The state when the participant has exit room
497+
*/
498+
EXITED = 'exited',
499+
}
500+
501+
export interface Participant {
502+
participantId: string;
503+
enteredAt: number;
504+
updatedAt: number;
505+
exitedAt?: number;
506+
duration?: number;
507+
isLocalParticipant: boolean;
508+
state: ParticipantState;
509+
user: User;
510+
isAudioEnabled: boolean;
511+
isVideoEnabled: boolean;
512+
513+
setMediaView(mediaView: HTMLMediaElement): Promise<void>;
514+
}
515+
516+
export interface LocalParticipant extends Participant {
517+
isLocalParticipant: true;
518+
519+
/**
520+
* Alias for setMediaView
521+
*/
522+
setLocalMediaView(mediaView: HTMLMediaElement): Promise<void>;
523+
524+
/**
525+
* Stop the local audio.
526+
*/
527+
muteMicrophone(): void;
528+
/**
529+
* Start the local audio.
530+
*/
531+
unmuteMicrophone(): void;
532+
533+
/**
534+
* Start the local video.
535+
*/
536+
stopVideo(): void;
537+
538+
/**
539+
* Stop the local video.
540+
*/
541+
startVideo(): void;
542+
543+
}
544+
545+
export interface RemoteParticipant extends Participant {
546+
isLocalParticipant: false;
547+
}

SendBirdCall.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sendbird-calls",
3-
"version": "1.5.3",
3+
"version": "1.6.0-beta",
44
"authors": [
55
"SendBird <[email protected]>"
66
],

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sendbird-calls",
3-
"version": "1.5.3",
3+
"version": "1.6.0-beta",
44
"description": "SendBird Calls JavaScript SDK",
55
"main": "SendBirdCall.min.js",
66
"types": "SendBirdCall.min.d.ts",

0 commit comments

Comments
 (0)