Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SendBirdCall

Hierarchy

  • SendBirdCall

Index

Accessors

Static DirectCallEndResult

Static DirectCallOption

Static DirectCallRecordOption

Static DirectCallUserRole

Static ErrorCode

Static LoggerLevel

  • const loggerLevel = {
      NONE: 'NONE', // Not used for writing log outputs.
      ERROR: 'ERROR', // Logs that represent the failure of the Calls SDK execution.
      WARNING: 'WARNING', // Logs that indicate potentially problematic situations.
      INFO: 'INFO', // Logs that track the general events of the Calls SDK.
    };
    

    Returns LoggerLevel

Static RecordingType

Static RoomType

Static SoundType

Static TokenType

Static appId

  • get appId(): string
  • Returns APP ID

    Returns string

Static currentUser

  • get currentUser(): User
  • Returns current user

    Returns User

Static sdkVersion

  • get sdkVersion(): string
  • Returns SDK version.

    Returns string

Methods

Static addDirectCallSound

  • addDirectCallSound(type: SoundType, url: string): Promise<boolean>
  • Add call sound for specific SoundType.

    Note: In modern web browsers, they have their own autoplay policies and can block the addDirectCallSound() method from being directly executed. To solve this problem, for Chrome and Firefox, the addDirectCallSound() method should be called after a user’s event such as clicking a button. For Safari, you have to call the addDirectCallSound() method in the event listener of a user’s event such as onclick() .

    document.querySelector('#yourButton').addEventListener('click', function() {
      SendBirdCall.addDirectCallSound(SendBirdCall.SoundType.DIALING, RESOURCE_URL);
    });
    

    Parameters

    Returns Promise<boolean>

Static addListener

  • Add a device-specific SendBirdCallListener event handler. Once the event handler is added, responding to device events such as incoming calls can be managed as shown below:

    // The UNIQUE_HANDLER_ID below is a unique user-defined ID for a specific event handler.
    SendBirdCall.addListener(UNIQUE_HANDLER_ID, {
      onRinging: (call) => {
        ...
      }
    });
    

    Parameters

    Returns void

Static addRecordingListener

Static authenticate

  • In order to use the interfaces and methods provided in a SendBirdCall instance, a user must be connected to SendBird server by authentication. Without authentication, calling the methods of the Calls SDK will not work.

    Authenticate method must be called after initialization

    Parameters

    Returns Promise<User>

Static connectWebSocket

  • connectWebSocket(): Promise<unknown>
  • Create WebSocket connection to SendBird server. A user can receive a dial and many other peer signals via WebSocket connection.

    Returns Promise<unknown>

Static createDirectCallLogListQuery

  • A user’s call history can be retrieved using the next() method of a DirectCallLogListQuery instance which returns a list of call objects.

    const params = {
      myRole: 'dc_caller',
      endResults: ['DECLINED', 'COMPLETED'],
      limit: 100
    };
    const query = SendBirdCall.createDirectCallLogListQuery(params);
    query.next((directCallLog) => {
      if (query.hasNext && !query.isLoading) {
        // The query.next() can be called once more to fetch more call logs.
      }
    });
    

    Parameters

    Returns DirectCallLogListQuery

Static createRoom

  • createRoom(params: RoomParams): Promise<Room>
  • Creates a new room for group calls.

    Parameters

    • params: RoomParams

    Returns Promise<Room>

Static createRoomListQuery

Static deauthenticate

  • deauthenticate(): void
  • Deauthenticate SendBirdCall instance. A User can no longer use the interfaces and methods provided in a SendBirdCall instance.

    WebSocket connection will also be disconnected during the call.

    Returns void

Static deleteAllCustomItems

  • Delete all custom items associated with the call

    Parameters

    Returns Promise<{}>

Static deleteCustomItems

  • deleteCustomItems(callId: string, customItemKeys: string[], callback?: CustomItemsHandler): true | Promise<{}>
  • You can delete a specific custom item with its given key.

    const customItemKeysToDelete = ['key1', 'key2'];
    SendBirdCall.deleteCustomItems('call-id', customItemKeysToDelete)
      .then(result => {
           // Handle deleted custom items using a returned promise.
         }, error => {
           // Handle error
         });
    

    Parameters

    Returns true | Promise<{}>

Static dial

  • Initiate a call by providing the callee’s user id into the SendBirdCall.dial() method. Use the CallOption object to choose initial call configuration, such as audio or video capabilities, video settings, and mute settings.

    const dialParams = {
      userId: CALLEE_ID,
      isVideoCall: true,
      callOption: {
        localMediaView: document.getElementById('local_video_element_id'),
        remoteMediaView: document.getElementById('remote_video_element_id'),
        audioEnabled: true,
        videoEnabled: true
      }
    };
    const call = SendBirdCall.dial(dialParams, (call, error) => {
      if (error) {
        // Dialing failed
      }
      // Dialing succeeded
    });
    

    Parameters

    Returns DirectCall

Static fetchRoomById

  • fetchRoomById(roomId: string): Promise<Room>
  • Fetch a room by its ID.

    Parameters

    • roomId: string

    Returns Promise<Room>

Static getAvailableAudioInputDevices

  • getAvailableAudioInputDevices(): InputDeviceInfo[]
  • Returns a set of available audio input devices.

    Returns InputDeviceInfo[]

Static getAvailableAudioOutputDevices

  • getAvailableAudioOutputDevices(): MediaDeviceInfo[]
  • Returns a set of available audio input devices.

    Returns MediaDeviceInfo[]

Static getAvailableVideoInputDevices

  • getAvailableVideoInputDevices(): InputDeviceInfo[]
  • Returns a set of available video devices.

    Returns InputDeviceInfo[]

Static getCachedRoomById

  • getCachedRoomById(roomId: string): Room
  • Gets a cached room by its ID.

    Parameters

    • roomId: string

    Returns Room

Static getCall

  • Returns a call

    Parameters

    • callId: string

    Returns DirectCall

Static getCurrentAudioInputDevice

  • getCurrentAudioInputDevice(): InputDeviceInfo
  • Returns the current audio input device.

    Returns InputDeviceInfo

Static getCurrentAudioOutputDevice

  • getCurrentAudioOutputDevice(): MediaDeviceInfo
  • Returns the current audio output device.

    Returns MediaDeviceInfo

Static getCurrentVideoInputDevice

  • getCurrentVideoInputDevice(): InputDeviceInfo
  • Returns the current video input device.

    Returns InputDeviceInfo

Static getOngoingCallCount

  • getOngoingCallCount(): number
  • Returns the number of ongoing calls

    Returns number

Static getOngoingCalls

  • Returns the call objects of ongoing calls

    Returns DirectCall[]

Static handleWebhookData

  • Pass Webhook data to sendbird-calls SDK.

    Parameters

    Returns void

Static init

  • init(appId: string, apiHost: string, websocketHost: string): boolean
  • Parameters

    • appId: string
    • apiHost: string
    • websocketHost: string

    Returns boolean

Static isPlaying

  • Returns true if DirectCallSound is playing.

    Parameters

    Returns boolean

Static registerPushToken

  • registerPushToken(pushToken: string, tokenType: TokenType): Promise<any>
  • Register the user's push token.

    Parameters

    Returns Promise<any>

Static removeAllListeners

  • removeAllListeners(): void
  • Unregister all SendBirdCall listeners.

    Returns void

Static removeAllRecordingListeners

  • removeAllRecordingListeners(): void
  • Unregister all recording listener.

    Returns void

Static removeDirectCallSound

  • removeDirectCallSound(type: SoundType): boolean
  • Remove call sound for specific SoundType.

    Parameters

    Returns boolean

Static removeListener

  • removeListener(id: string): void
  • Unregister a SendBirdCall listener.

    Parameters

    • id: string

    Returns void

Static removeRecordingListener

  • removeRecordingListener(id: string): void
  • Unregister a recording listener.

    Parameters

    • id: string

    Returns void

Static selectAudioInputDevice

  • selectAudioInputDevice(mediaDeviceInfo: InputDeviceInfo): void
  • Selects the audio input device.

    Parameters

    • mediaDeviceInfo: InputDeviceInfo

    Returns void

Static selectAudioOutputDevice

  • selectAudioOutputDevice(mediaDeviceInfo: MediaDeviceInfo): void
  • Select the audio output device.

    Parameters

    • mediaDeviceInfo: MediaDeviceInfo

    Returns void

Static selectVideoInputDevice

  • selectVideoInputDevice(mediaDeviceInfo: InputDeviceInfo): void
  • Selects the video input device.

    Parameters

    • mediaDeviceInfo: InputDeviceInfo

    Returns void

Static setCallConnectionTimeout

  • setCallConnectionTimeout(timeout: number): void
  • Set timeout value of call connection

    Parameters

    • timeout: number

    Returns void

Static setLoggerLevel

  • You can specify log level to display log output to the console.

    Parameters

    Returns LEVELS

Static setRingingTimeout

  • setRingingTimeout(timeout: number): void
  • Set timeout value of ringing

    Parameters

    • timeout: number

    Returns void

Static unregisterAllPushTokens

  • unregisterAllPushTokens(tokenType: TokenType): Promise<any>
  • Unregister the user's all push tokens.

    Parameters

    Returns Promise<any>

Static unregisterPushToken

  • unregisterPushToken(pushToken: string, tokenType: TokenType): Promise<any>
  • Unregister the user's push token.

    Parameters

    Returns Promise<any>

Static updateCustomItems

  • Custom items can be added to a call either by a caller or a callee. When dialing, the caller can add a Dictionary of String and String to a DialParams object by using the customItems property. The default value of a call's custom items is an empty Dictionary.

    const customItemsToAdd = { key1: 'value1', key2: 'value2' };
    SendBirdCall.updateCustomItems('call-id', customItemsToAdd)
      .then(result => {
           // Handle added custom items using a returned promise.
         }, error => {
           // Handle error
         });
    

    Parameters

    Returns true | Promise<{}>

Static updateMediaDevices

  • updateMediaDevices(constraints: Object): Promise<void>
  • Manually updates media devices.

    Note: In Chrome or Firefox, the SendBirdCall.updateMediaDevices() doesn’t need to be called if the media device event listener is used to update the view or device list. However, in Safari, those event listeners might not need to be called after a media device has been changed. In such cases, calling the SendBirdCall.updateMediaDevices() manually may be required.

    Parameters

    • constraints: Object

    Returns Promise<void>

Static useMedia

  • The Calls SDK requires access permissions to microphone and camera to communicate with Sendbird server. This method will retrieve a list of available media devices or any actual media streams.

    Note: When a user makes or receives a call for the first time by your JavaScript application running in a browser, the browser might prompt the user to grant microphone and camera access permissions.

    Parameters

    • constraints: Object

    Returns MediaAccess

Generated using TypeDoc