1- /** 1.6.0-beta */
2- // eslint-disable-next-line no-undef,max-classes-per-file
1+ /** 1.5.4 */
2+
3+ // eslint-disable-next-line no-undef
34export as namespace SendBirdCall ;
45
56export function init ( appId : string ) : void ;
@@ -36,9 +37,6 @@ export function handleWebhookData(data: WebhookData): void;
3637export function addDirectCallSound ( type : SoundType , url : string ) : Promise < boolean > ;
3738export function removeDirectCallSound ( type : SoundType ) : boolean ;
3839export 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 > ;
4240export const sdkVersion : string ;
4341export const appId : string ;
4442export const currentUser : User ;
@@ -148,64 +146,6 @@ export interface SendBirdCallRecordingListener {
148146 onRecordingFailed : ( ( callId : string , recordingId : string , error ) => void ) | null ;
149147}
150148
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-
209149export interface DirectCall {
210150 onEstablished : ( ( call : DirectCall ) => void ) | null ;
211151 onConnected : ( ( call : DirectCall ) => void ) | null ;
@@ -219,6 +159,8 @@ export interface DirectCall {
219159 onRemoteRecordingStatusChanged : ( ( call : DirectCall ) => void ) | null ;
220160 onEnded : ( ( call : DirectCall ) => void ) | null ;
221161
162+ onScreenShareStopped : ( ( ) => void ) | null ;
163+
222164 readonly callId : string ;
223165 readonly caller : DirectCallUser ;
224166 readonly callee : DirectCallUser ;
@@ -240,6 +182,7 @@ export interface DirectCall {
240182 readonly remoteRecordingStatus : RecordingStatus ;
241183 readonly localMediaView : HTMLMediaElement ;
242184 readonly remoteMediaView : HTMLMediaElement ;
185+ readonly isLocalScreenShareEnabled : boolean ;
243186
244187 setLocalMediaView ( mediaView : HTMLMediaElement ) : Promise < void > ;
245188 setRemoteMediaView ( mediaView : HTMLMediaElement ) : Promise < void > ;
@@ -263,6 +206,9 @@ export interface DirectCall {
263206
264207 startRecording ( options : DirectCallRecordOption ) : string ;
265208 stopRecording ( recordId : string ) : boolean ;
209+
210+ startScreenShare ( ) : Promise < void > ;
211+ stopScreenShare ( ) : void ;
266212}
267213
268214export interface DirectCallOption {
@@ -398,150 +344,3 @@ export interface WebhookData {
398344 [ key : string ] : any ;
399345}
400346/* 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- }
0 commit comments