SDK Reference

The talksphere-sdk is the primary way to interact with the platform from the browser.

Installation

npm install talksphere-sdk

class TalksphereSDK

The main entry point for the library.

Constructor

new TalksphereSDK(options: SDKOptions)

Options:

  • apiKey (string): Your project's API key.

Methods

join(roomId: string, options?: JoinOptions): Promise<Room>

Connects to a room. Returns a Promise that resolves to a Room object.

  • roomId: Unique identifier for the room.
  • options.video (boolean): Whether to capture camera. Default true.
  • options.audio (boolean): Whether to capture microphone. Default true.

class Room

Represents an active connection to a conference.

Events

The Room class extends EventEmitter.

  • 'participant-joined': Emitted when a remote user joins.
  • 'participant-left': Emitted when a remote user leaves.
  • 'track-subscribed': Emitted when a new audio/video track is received.

Methods

leave(): void

Disconnects from the room and stops all media tracks.

toggleAudio(enabled: boolean): void

Mutes or unmutes the local microphone.

toggleVideo(enabled: boolean): void

Enables or disables the local camera.