Livekitex.RoomService (livekitex v0.1.0)
Provides functionality to interact with the LiveKit RoomService API using Twirp.
Summary
Functions
Creates a new RoomService client.
Creates a new room.
Deletes a room.
Lists participants in a room.
Lists all rooms.
Mutes or unmutes a published track.
Removes a participant from a room.
Types
@type t() :: %Livekitex.RoomService{ api_key: String.t(), api_secret: String.t(), client: Tesla.Client.t() | nil, host: String.t(), port: integer() }
Functions
Creates a new RoomService client.
Parameters
api_key
: The API key for your LiveKit project.api_secret
: The API secret for your LiveKit project.options
: A keyword list of options.host
: The host of the LiveKit server. Defaults to "localhost".port
: The port of the LiveKit server. Defaults to 7880.
Examples
iex> Livekitex.RoomService.create("api_key", "api_secret")
%Livekitex.RoomService{
api_key: "api_key",
api_secret: "api_secret",
host: "localhost",
port: 7880
}
Creates a new room.
Parameters
room_service
: The RoomService client.name
: The name of the room.options
: A keyword list of options.empty_timeout
: Room timeout when empty (seconds)departure_timeout
: Timeout after participant departure (seconds)max_participants
: Maximum number of participantsmetadata
: Room metadatamin_playout_delay
: Minimum playout delay (ms)max_playout_delay
: Maximum playout delay (ms)sync_streams
: Whether to sync streams
Examples
iex> room_service = Livekitex.RoomService.create("devkey", "secret")
iex> Livekitex.RoomService.create_room(room_service, "test-room")
{:ok, %Livekitex.Room{}}
Deletes a room.
Parameters
room_service
: The RoomService client.room_name
: The name of the room to delete.
Examples
iex> room_service = Livekitex.RoomService.create("devkey", "secret")
iex> Livekitex.RoomService.delete_room(room_service, "test-room")
:ok
Lists participants in a room.
Parameters
room_service
: The RoomService client.room_name
: The name of the room.
Examples
iex> room_service = Livekitex.RoomService.create("devkey", "secret")
iex> Livekitex.RoomService.list_participants(room_service, "test-room")
{:ok, []}
Lists all rooms.
Parameters
room_service
: The RoomService client.options
: A keyword list of options.names
: List of specific room names to filter by
Examples
iex> room_service = Livekitex.RoomService.create("devkey", "secret")
iex> Livekitex.RoomService.list_rooms(room_service)
{:ok, []}
Mutes or unmutes a published track.
Parameters
room_service
: The RoomService client.room_name
: The name of the room.identity
: The identity of the participant.track_sid
: The SID of the track to mute/unmute.muted
: Whether to mute (true) or unmute (false) the track.
Examples
iex> room_service = Livekitex.RoomService.create("devkey", "secret")
iex> Livekitex.RoomService.mute_published_track(room_service, "test-room", "user123", "track_sid", true)
{:ok, %{}}
Removes a participant from a room.
Parameters
room_service
: The RoomService client.room_name
: The name of the room.identity
: The identity of the participant to remove.
Examples
iex> room_service = Livekitex.RoomService.create("devkey", "secret")
iex> Livekitex.RoomService.remove_participant(room_service, "test-room", "user123")
:ok