API Reference

class AudioData

This class represents received audio data. It contains a bytestring with the audio frames and other attributes such as bits per sample and sample rate.

audio_frames

A bytestring with the audio frames

bits_per_sample

The bits per sample of the audio data

num_audio_frames

The number of audio frames

num_channels

The number of audio channels

sample_rate

The sample rate

class CallClient(event_handler=None)

This class represents a call client. A call client is a participant of a Daily meeting and it can receive audio and video from other participants in the meeting as well as send audio and video. Multiple instances of call clients can be created in the same application.

Parameters:

event_handler (class) – A subclass of EventHandler

active_speaker()

Returns the current active speaker.

Returns:

See Participant

Return type:

Mapping[str, Any]

add_custom_audio_track(track_name, audio_track, ignore_audio_level=None, completion=None)

Adds a new custom audio track with the given name. Audio frames need to be written using the audio source.

Parameters:
  • track_name (str) – The audio track name

  • audio_track (CustomAudioTrack) – The custom audio track being added

  • bool (Optional) – If the audio track should be ignored by the SFU when calculating the audio level

  • completion (Optional[func]) – An optional completion callback with one parameter: (CallClientError)

add_live_streaming_endpoints(endpoints, stream_id=None, completion=None)

Adds additional preconfigured endpoints to an existing live stream.

Parameters:
  • endpoints (List[str]) – A list of preconfigured live streaming endpoints

  • stream_id (Optional[str]) – A unique stream identifier

  • completion (Optional[func]) – An optional completion callback with one parameter: (CallClientError)

eject_remote_participants(ids, completion=None)

Ejects remote participants.

Parameters:
  • ids (List[str]) – A list of IDs of remote participants to eject

  • completion (Optional[func]) – An optional completion callback with one parameter: (CallClientError)

get_network_stats()

Returns the latest network statistics.

Returns:

See NetworkStats

Return type:

Mapping[str, Any]

inputs()

Returns the current client inputs. The inputs define the call client video and audio sources (i.e. cameras and microphones).

Returns:

See InputSettings

Return type:

Mapping[str, Any]

join(meeting_url, meeting_token=None, client_settings=None, completion=None)

Join a meeting given the meeting_url and the optional meeting_token and client_settings. The client settings specifie inputs updates or publising settings.

Parameters:
  • meeting_url (str) – The URL of the Daily meeting to join

  • meeting_token (Optional[str]) – Meeting token if needed. This is needed if the client is an owner of the meeting

  • client_settings (Optional[Mapping[str, Any]]) – See ClientSettings

  • completion (Optional[func]) – An optional completion callback with two parameters: (CallClientJoinData, CallClientError)

leave(completion=None)

Leave a previously joined meeting.

Parameters:

completion (Optional[func]) – An optional completion callback with one parameter: (CallClientError)

participant_counts()

Returns the number of hidden and non-hidden participants in the meeting.

Returns:

The number of participants in the meeting. See ParticipantCounts

Return type:

Mapping[str, Any]

participants()

Returns the current participants in the meeting.

Returns:

See CallParticipants

Return type:

Mapping[str, Any]

publishing()

Returns the current client publishing settings. The publishing settings specify if media should be published (i.e. sent) and, if so, how it should be sent (e.g. what resolutions or bitrate).

Returns:

See PublishingSettings

Return type:

Mapping[str, Any]

release()

Release internal resources. This function should be called when this object is not needed anymore making sure all internal resources are freed.

If this function is not called we will attempt to automatically call it during garbage collection. However, that’s not guaranteed (e.g. if there’s a circular dependency with the registered event handler), therefore it is strongly recommended to always call this function.

remove_custom_audio_track(track_name, completion=None)

Removes an existing custom audio track.

Parameters:
  • track_name (str) – The audio track name

  • completion (Optional[func]) – An optional completion callback with one parameter: (CallClientError)

remove_live_streaming_endpoints(endpoints, stream_id=None, completion=None)

Removes endpoints from an existing live stream.

Parameters:
  • endpoints (List[str]) – The list of live streaming endpoints to remove

  • stream_id (Optional[str]) – A unique stream identifier

  • completion (Optional[func]) – An optional completion callback with one parameter: (CallClientError)

send_app_message(message, participant_id=None, serialize_none=True, completion=None)

Sends a message to other participants, or another specific participant, during the call.

Parameters:
  • message (Any) – The message to send (should be serializable to JSON)

  • participant_id (Optional[str]) – The participant ID to send the message to. Or None to broadcast the message

  • serialize_none (bool) – Whether None should be serialized to null (default: true)

  • completion (Optional[func]) – An optional completion callback with one parameter: (CallClientError)

send_dtmf(settings=None, completion=None)

Sends DTMF tones in an existing dial-out session.

Parameters:
send_prebuilt_chat_message(message, user_name=None, completion=None)

Sends a chat message to Daily’s Prebuilt main room.

Parameters:
  • message (str) – The chat message to send

  • user_name (Optional[str]) – The user name that will appear as a sender of the message

  • completion (Optional[func]) – An optional completion callback with one parameter: (CallClientError)

set_audio_renderer(participant_id, callback, audio_source='microphone', sample_rate=16000, callback_interval_ms=20, logging_interval_ms=10000)

Registers an audio renderer for the given audio source of the provided participant.

Parameters:
  • participant_id (str) – The ID of the participant to receive audio from

  • callback (func) – A callback to be called when audio data is available. It receives three arguments: the participant ID, the AudioData and the audio source

  • audio_source (str) – The audio source of the remote participant to receive (e.g. microphone, screenAudio or a custom track name)

  • sample_rate (str) – The sample rate the audio should be resampled to

  • callback_interval_ms (str) – How often the callback should be called (multiple of 10ms)

  • logging_interval_ms (str) – Set logging internal (only with debug logging)

set_ice_config(ice_config=None, completion=None)

Allows for specifying custom TURN servers rather than only using Daily’s default TURN servers.

Parameters:
  • ice_config (Optional[Mapping[str, Any]]) – See IceConfig or None to unset the current ICE config

  • completion (Optional[func]) – An optional completion callback with one parameter: (CallClientError)

set_proxy_url(proxy_url=None, completion=None)

Sets a proxy URL for this client. For users whose firewall policies prevent them from directly accessing Daily’s web domains, using a proxy URL provide a mechanism to send connections to Daily’s HTTPS and WebSocket endpoints to a specified proxy server instead.

Parameters:
  • proxy_url (Optional[str]) – The proxy URL to use or None to unset the current proxy.

  • completion (Optional[func]) – An optional completion callback with one parameter: (CallClientError)

set_user_name(user_name)

Sets this client’s user name. The user name is what other participants might be able to see as a description of this client.

Parameters:

user_name (str) – This client’s user name

set_video_renderer(participant_id, callback, video_source='camera', color_format='RGBA', logging_interval_ms=10000)

Registers a video renderer for the given video source of the provided participant. The color format of the received frames can be chosen.

Parameters:
  • participant_id (str) – The ID of the participant to receive video from

  • callback (func) – A callback to be called on every received frame. It receives three arguments: the participant ID, a VideoFrame and the video source

  • video_source (str) – The video source of the remote participant to receive (e.g. camera, screenVideo or a custom track name)

  • color_format (str) – The color format that frames should be received. See ColorFormat

  • logging_interval_ms (str) – Set logging internal (only with debug logging)

sip_call_transfer(settings=None, completion=None)

Transfer a SIP dial-in call from one Daily room to another Daily room. Alternatively, transfer an initiated SIP/PSTN dial-out to another SIP URI or PSTN number.

Parameters:
sip_refer(settings=None, completion=None)

Transfer a SIP dial-in call to another SIP endpoint outside Daily.

Parameters:
start_dialout(settings=None, completion=None)

Starts a dial-out service. This can be done by meeting owners when dial-out is enabled in the Daily domain.

Parameters:
  • settings (Optional[Mapping[str, Any]]) – See DialoutSettings

  • completion (Optional[func]) – An optional completion callback with one parameter: (CallClientError)

start_live_stream_with_endpoints(endpoints, streaming_settings=None, stream_id=None, force_new=None, completion=None)

Starts a new live-stream with the given pre-configured endpoints.

Parameters:
  • endpoints (List[str]) – A list of preconfigured live streaming endpoints

  • streaming_settings (Optional[Mapping[str, Any]]) – See StreamingSettings

  • stream_id (Optional[str]) – A unique stream identifier. Multiple live streaming sessions can be started by specifying a unique ID

  • force_new (Optional[str]) – Whether to force a new live stream, even if there is already one in progress

  • completion (Optional[func]) – An optional completion callback with one parameter: (CallClientError)

start_live_stream_with_rtmp_urls(rtmp_urls, streaming_settings=None, stream_id=None, force_new=None, completion=None)

Starts a new live-stream with the given RTMP URLs.

Parameters:
  • rtmp_urls (List[str]) – A list of live streaming RTMP URLs

  • streaming_settings (Optional[Mapping[str, Any]]) – See StreamingSettings

  • stream_id (Optional[str]) – A unique stream identifier. Multiple live streaming sessions can be started by specifying a unique ID

  • force_new (Optional[bool]) – Whether to force a new live stream, even if there is already one in progress

  • completion (Optional[func]) – An optional completion callback with one parameter: (CallClientError)

start_recording(streaming_settings=None, stream_id=None, force_new=None, completion=None)

Starts a recording, if recording is enabled for the current room.

Parameters:
  • streaming_settings (Optional[Mapping[str, Any]]) – See StreamingSettings

  • stream_id (Optional[str]) – A unique stream identifier. Multiple recording sessions can be started by specifying a unique ID

  • force_new (Optional[bool]) – Whether to force a new recording, even if there is already one in progress

  • completion (Optional[func]) – An optional completion callback with one parameter: (CallClientError)

start_transcription(settings=None, completion=None)

Starts a transcription service. This can be done by meeting owners or transcription admins when transcription is enabled in the Daily domain.

Parameters:
stop_dialout(participant_id, completion=None)

Stops a currently running dial-out service. This can be done by meeting owners when dial-out is enabled in the Daily domain.

Parameters:
  • participant_id (str) – The participant ID of the dial-out session to stop

  • completion (Optional[func]) – An optional completion callback with one parameter: (CallClientError)

stop_live_stream(stream_id=None, completion=None)

Stops an ongoing live stream. If multiple live stream instances are running, each instance must be stopped individually by providing the unique stream ID.

Parameters:
  • stream_id (Optional[str]) – A unique stream identifier

  • completion (Optional[func]) – An optional completion callback with one parameter: (CallClientError)

stop_recording(stream_id=None, completion=None)

Stops an ongoing recording. If multiple recording instances are running, each instance must be stopped individually by providing the unique stream ID.

Parameters:
  • stream_id (Optional[str]) – A unique stream identifier

  • completion (Optional[func]) – An optional completion callback with one parameter: (CallClientError)

stop_transcription(completion=None)

Stops a currently running transcription service. This can be done by meeting owners or transcription admins when transcription is enabled in the Daily domain.

Parameters:

completion (Optional[func]) – An optional completion callback with one parameter: (CallClientError)

subscription_profiles()

Returns the current client subscription profiles. A subscription profile gives a set of subscription media settings a name.

Returns:

See SubscriptionProfileSettings

Return type:

Mapping[str, Any]

subscriptions()

Returns the current client subscriptions. The client subscriptions is an object containing specific subscriptions per remote participant.

Returns:

See ParticipantSubscriptions

Return type:

Mapping[str, Any]

update_custom_audio_track(track_name, audio_track, ignore_audio_level=None, completion=None)

Updates an existing custom audio track with a new custom audio source.

Parameters:
  • track_name (str) – The audio track name

  • audio_track (CustomAudioTrack) – The new custom audio track

  • bool (Optional) – If the audio track should be ignored by the SFU when calculating the audio level

  • completion (Optional[func]) – An optional completion callback with one parameter: (CallClientError)

update_inputs(input_settings, completion=None)

Updates input settings. This function allows you to update the call client video and audio inputs.

Parameters:
  • input_settings (Mapping[str, Any]) – See InputSettings

  • completion (Optional[func]) – An optional completion callback with one parameter: (CallClientError)

update_live_stream(update_settings, stream_id=None, completion=None)

Updates an ongoing live stream. If multiple live stream instances are running, each instance must be updated individually by providing the unique stream ID.

Parameters:
  • update_settings (Mapping[str, Any]) – See StreamingUpdateSettings

  • stream_id (Optional[str]) – A unique stream identifier

  • completion (Optional[func]) – An optional completion callback with one parameter: (CallClientError)

update_permissions(permissions, completion=None)

Updates the client permissions. This will only update permissions for this client and is only allowed if this client is the owner of the meeting.

Parameters:
update_publishing(publishing_settings, completion=None)

Updates publishing settings. This function allows you to update the call client video and audio publishing settings.

Parameters:
  • publishing_settings (Mapping[str, Any]) – See PublishingSettings

  • completion (Optional[func]) – An optional completion callback with one parameter: (CallClientError)

update_recording(update_settings, stream_id=None, completion=None)

Updates an ongoing recording. If multiple recording instances are running, each instance must be updated individually by providing the unique stream ID.

Parameters:
  • update_settings (Mapping[str, Any]) – See StreamingUpdateSettings

  • stream_id (Optional[str]) – A unique stream identifier

  • completion (Optional[func]) – An optional completion callback with one parameter: (CallClientError)

update_remote_participants(remote_participants, completion=None)

Updates remote participants.

Parameters:
update_subscription_profiles(profile_settings, completion=None)

Updates subscription profiles.

Parameters:
update_subscriptions(participant_settings=None, profile_settings=None, completion=None)

Updates subscriptions and subscription profiles. This function allows you to update subscription profiles and at the same time assign specific subscription profiles to a participant and even change specific settings for some participants.

Parameters:
update_transcription(participants=None, instance_id=None, completion=None)

Updates a transcription service. This allows selecting participants who should be transcribed (by default all are). This can be done by meeting owners or transcription admins when transcription is enabled in the Daily domain.

Parameters:
  • participants (Optional[List[str]]) – List of participant IDs who should be transcribed or None to transcrible all

  • instance_id (Optional[str]) – An optional transcription instance ID

  • completion (Optional[func]) – An optional completion callback with one parameter: (CallClientError)

class CustomAudioSource(sample_rate, channels)

This class represents a custom audio source. Custom audio sources are used to send audio to an audio track. See daily.CallClient.add_custom_audio_track().

The audio format used by custom audio sources is 16-bit linear PCM.

channels

Returns the number of channels (2 for stereo and 1 for mono) of this audio source.

Returns:

The number of channels

Return type:

int

sample_rate

Returns the sample rate of this audio source (e.g. 16000).

Returns:

The sample rate

Return type:

int

write_frames(frames, completion=None)

Writes audio frames to the audio source. The frames will be sent to the audio track if this source is attached to a track.

This function blocks, if a completion callback is not provided, until the audio frames have been written. If a completion callback is provided this function is non-blocking and the completion callback will be called when the audio frames are written.

Parameters:
  • frames (bytestring) – A bytestring with the audio frames to write

  • completion (func) – An optional completion callback with one parameter: (int)

Returns:

The number of audio frames written

Return type:

int

class CustomAudioTrack(audio_source)

This class represents a custom audio track. Custom audio tracks need a CustomAudioSource to write audio frames.

Custom audio tracks can be used to send additional custom tracks or as the main microphone track.

id

Returns the track id.

Returns:

The track id

Return type:

str

class Daily

This class is used to initialize the SDK and create virtual devices.

static create_camera_device(device_name, width, height, color_format='RGBA')

Creates a new virtual camera device. Camera devices are used to send video (i.e. video frames) into the meeting.

Parameters:
  • device_name (str) – The virtual camera device name

  • width (int) – Resolution width

  • height (int) – Resolution height

  • color_format (str) – The color format of the frames that will be written to the camera device. See ColorFormat

Returns:

A new virtual camera device

Return type:

VirtualCameraDevice

static create_microphone_device(device_name, sample_rate=16000, channels=1, non_blocking=False)

Creates a new virtual microphone device. Microphone devices are used to send audio (i.e. write audio frames) to the meeting.

Microphone devices are selected with CallClient.update_inputs().

Virtual microphone devices emulate a hardware device and have the constraint that only one microphone can be active per process However, it is possible to use a custom microphone audio track when specifying the call client input settings.

Parameters:
  • device_name (str) – The virtual microphone device name. This can be used as a deviceId when configuring the call client inputs

  • sample_rate (int) – Sample rate

  • channels (int) – Number of channels (2 for stereo, 1 for mono)

  • non_blocking (bool) – Whether the microphone will be blocking or non-blocking

Returns:

A new virtual microphone device

Return type:

VirtualMicrophoneDevice

static create_native_vad(reset_period_ms=1000, sample_rate=16000, channels=1)

Creates a new VAD analyzer. VADs are used to detect speech from an audio stream.

Parameters:
  • reset_period_ms (int) – The period in milliseconds after the VAD is internally reset

  • sample_rate (int) – Sample rate of the incoming audio frames

  • channels (int) – Number of channels (2 for stereo, 1 for mono) of the incoming audio frames

Returns:

A new VAD

Return type:

NativeVad

static create_speaker_device(device_name, sample_rate=16000, channels=1, non_blocking=False)

Creates a new virtual speaker device. Speaker devices are used to receive audio (i.e. read audio frames) from the meeting.

Virtual speaker devices emulate a hardware device and have the constraint that only one speaker can be active per process. You can select the active speaker with select_speaker_device().

Parameters:
  • device_name (str) – The virtual speaker device name

  • sample_rate (int) – Sample rate

  • channels (int) – Number of channels (2 for stereo, 1 for mono)

  • non_blocking (bool) – Whether the speaker will be blocking or non-blocking

Returns:

A new virtual speaker device

Return type:

VirtualSpeakerDevice

static deinit()

Deallocates SDK resources. This is usually called when shutting down the application.

static init(worker_threads=2, log_level=Ellipsis)

Initializes the SDK. This function needs to be called before anything else, usually done at the application startup.

Parameters:
  • worker_threads (int) – Number of internal worker threads. Increasing this number might be necessary if the application needs to create a large number of concurrent call clients

  • log_level (LogLevel) – Set application log level

static select_speaker_device(device_name)

Selects one of the previously created virtual speaker devices to be the main system speaker. Note that there can only be one speaker selected at a time. Also, if there are multiple participants in the meeting, the audio from all the participants will be mixed and that’s the audio that is received in the speaker.

Parameters:

device_name (str) – The name of the virtual speaker device to select

static set_log_level(log_level=Ellipsis)

Sets the application log level.

Parameters:

log_level (LogLevel) – Set application log level

class EventHandler(*args)

This a base class for event handlers. Event handlers are used to handle events from the meeting, for example when a participant joins or leaves the meeting or when the active speaker changes.

Event handlers are registered when creating a CallClient and should be created as a subclass of this class. Since event handlers are created as a subclass, there is no need implement all the handler methods.

on_active_speaker_changed(participant)

Event emitted when the active speaker of the call has changed.

Parameters:

participant (Mapping[str, Any]) – See Participant

on_app_message(message, sender)

Event emitted when a custom app message is received from another participant or via the REST API.

Parameters:
  • message (Any) – Message received from a remote participant

  • sender (string) – Sender of the message

on_available_devices_updated(available_devices)

Event emitted when an audio device is plugged or removed.

Parameters:

available_devices (Mapping[str, Any]) – See AvailableDevices

on_call_state_updated(state)

Event emitted when the call state changes, normally as a consequence of invocations to daily.CallClient.join() or daily.CallClient.leave()

Parameters:

state (string) – See CallState

on_dialin_connected(data)

Event emitted when the session with the dial-in remote end is established (i.e. SIP endpoint or PSTN are connectd to the Daily room).

Note: connected does not mean media (audio or video) has started flowing between the room and PSTN, it means the room received the connection request and both endpoints are negotiating the media flow.

Parameters:

data (Mapping[str, Any]) – See DialinConnectedEvent

on_dialin_error(data)

Event emitted in the case of dial-in errors which are fatal and the service cannot proceed. For example, an error in SDP negotiation is fatal to the media/SIP pipeline and will result in dialin-error being triggered.

Parameters:

data (Mapping[str, Any]) – See DialinEvent

on_dialin_ready(sip_endpoint)

Event emitted when dial-in is ready. This happens after the room has connected to the SIP endpoint and the system is ready to receive dial-in calls.

Parameters:

sip_endpoint (string) – The SIP endpoint the room has connected to

on_dialin_stopped(data)

Event emitted when the dial-in remote end disconnects the call.

Parameters:

data (Mapping[str, Any]) – See DialinStoppedEvent

on_dialin_warning(data)

Event emitted there is a dial-in non-fatal error, such as the selected codec not being used and a fallback codec being utilized.

Parameters:

data (Mapping[str, Any]) – See DialinEvent

on_dialout_answered(data)

Event emitted when the session with the dial-out remote end is answered.

Parameters:

data (Mapping[str, Any]) – See DialoutEvent

on_dialout_connected(data)

Event emitted when the session with the dial-out remote end is established.

Parameters:

data (Mapping[str, Any]) – See DialoutEvent

on_dialout_error(data)

Event emitted in the case of dial-out errors which are fatal and the service cannot proceed. For example, an error in SDP negotiation is fatal to the media/SIP pipeline and will result in dialout-error being triggered.

Parameters:

data (Mapping[str, Any]) – See DialoutEvent

on_dialout_stopped(data)

Event emitted when the dial-out remote end disconnects the call or the call is stopped by calling daily.CallClient.stop_dialout().

Parameters:

data (Mapping[str, Any]) – See DialoutEvent

on_dialout_warning(data)

Event emitted there is a dial-out non-fatal error, such as the selected codec not being used and a fallback codec being utilized.

Parameters:

data (Mapping[str, Any]) – See DialoutEvent

on_error(message)

Event emitted when an error occurs.

Parameters:

message (string) – The error message

on_inputs_updated(input_settings)

Event emitted when the input settings are updated, normally as a consequence of invocations to daily.CallClient.join(), daily.CallClient.leave() or daily.CallClient.update_inputs().

Parameters:

inputs (Mapping[str, Any]) – See InputSettings

on_live_stream_error(stream_id, message)

Event emitted for all participants when a live stream encounters an error.

Parameters:
  • stream_id (string) – The ID of the live stream that generated the error

  • message (string) – The error message

on_live_stream_started(status)

Event emitted for all participants when a live stream starts.

Parameters:

status (Mapping[str, Any]) – See LiveStreamStatus

on_live_stream_stopped(stream_id)

Event emitted for all participants when a live stream stops.

Parameters:

stream_id (string) – The ID of the live stream that was stopped

on_live_stream_updated(update)

Event emitted for all participants when a live stream is updated.

Parameters:

update (Mapping[str, Any]) – See LiveStreamUpdate

on_live_stream_warning(stream_id, message)

Event emitted for all participants when a live stream encounters a warning.

Parameters:
  • stream_id (string) – The ID of the live stream that generated the warning

  • message (string) – The warning message

on_network_stats_updated(stats)

Event emitted when the logging & telemetry backend updates the network statistics.

Parameters:

stats (Mapping[str, Any]) – See NetworkStats

on_participant_counts_updated(counts)

Event emitted when the participant count changes.

Parameters:

stats (Mapping[str, Any]) – See ParticipantCounts

on_participant_joined(participant)

Event emitted when a participant joins the call.

Parameters:

participant (Mapping[str, Any]) – See Participant

on_participant_left(participant, reason)

Event emitted when a participant has left the call.

Parameters:
on_participant_updated(participant)

Event emitted when a participant is updated. This can mean either the participant’s metadata was updated, or the tracks belonging to the participant changed.

Parameters:

participant (Mapping[str, Any]) – See Participant

on_publishing_updated(publishing_settings)

Event emitted when the publishing settings are updated, normally as a consequence of invocations to daily.CallClient.join(), daily.CallClient.update_publishing().

Parameters:

publishing_settings (Mapping[str, Any]) – See PublishingSettings

on_recording_error(stream_id, message)

Event emitted when a recording error occurs.

Parameters:
  • stream_id (string) – The ID of the recording that generated the error

  • message (string) – The error message

on_recording_started(status)

Event emitted for all participants when a recording starts.

Parameters:

status (Mapping[str, Any]) – See RecordingStatus

on_recording_stopped(stream_id)

Event emitted for all participants when a recording stops.

Parameters:

stream_id (string) – The ID of the live stream that was stopped

on_subscription_profiles_updated(subscription_profiles)

Event emitted when the subscription profile settings are updated as a consequence of calls to daily.CallClient.update_subscription_profiles().

Parameters:

subscription_profiles (Mapping[str, Any]) – See SubscriptionProfileSettings

on_subscriptions_updated(subscriptions)

Event emitted when the subscription settings are updated as a consequence of calls to daily.CallClient.update_subscriptions().

Parameters:

subscriptions (Mapping[str, Any]) – See ParticipantSubscriptions

on_transcription_error(message)

Event emitted when a transcription error occurs.

Parameters:

message (string) – The error message

on_transcription_message(message)

Event emitted when a transcription message is received.

Parameters:

message (Mapping[str, Any]) – See TranscriptionMessage

on_transcription_started(status)

Event emitted when transcription starts.

Parameters:

status (Mapping[str, Any]) – See TranscriptionStatus

on_transcription_stopped(stopped_by, stopped_by_error)

Event emitted when transcription stops.

Parameters:
  • stopped_by (str) – The ID of the participant that stopped the transcription or None

  • stopped_by_error (bool) – Whether the transcription was stopped by an error

on_transcription_updated(update)

Event emitted when transcription is updated.

Parameters:

update (Mapping[str, Any]) – See TranscriptionUpdated

class NativeVad

This class represents a Voice Activity Detection (VAD) analyzer. VADs are used to detect speech on an audio stream.

This VAD implementation works by analyzing 10ms audio frames at a time returning a confidence probability. It is possible to build a more sophisticated VAD (e.g. one that detects long sentences) on top of this one.

The audio format used by this VAD is 16-bit linear PCM.

analyze_frames(frames)

Analyzes 10ms of audio frames and returns the confidence probability that speech was detected. If more than 10ms of audio frames are given, only the first 10ms will be used.

Returns:

The probability (from 0 to 1.0) that speech was detected

Return type:

float

channels

Returns the number of channels (2 for stereo and 1 for mono) of incoming audio frames for this VAD.

Returns:

The number of channels

Return type:

int

reset_period_ms

Returns the number of milliseconds after which the internal VAD is reset. It should be at least 20ms.

Returns:

The sample rate

Return type:

int

sample_rate

Returns the sample rate of incoming audio frames for this VAD (e.g. 16000).

Returns:

The sample rate

Return type:

int

class VideoFrame

This class represents a received video frame. It contains a bytestring with frame contents and other frame attributes such as width and height.

buffer

A bytestring with the frame data in the corresponding color format

color_format

The frame’s color format

height

The height this frame

timestamp_us

The time in microseconds that the frame was received

width

The width of this frame

class VirtualCameraDevice

This class represents a virtual camera device. Virtual camera devices are used to send video to the meeting.

color_format

Returns the color format of this camera.

Returns:

See ColorFormat

Return type:

str

height

Returns the resolution height of this camera.

Returns:

The resolution height

Return type:

int

name

Returns the device name.

Returns:

The virtual camera device name

Return type:

str

width

Returns the resolution width of this camera.

Returns:

The resolution width

Return type:

int

write_frame(frame)

Writes a video frame to a virtual camera device created with Daily.create_camera_device().

The video frame needs to be of the same color format (see ColorFormat) specified when creating the camera.

Parameters:

frame (bytestring) – A bytestring with the video frame contents

class VirtualMicrophoneDevice

This class represents a virtual microphone device. Virtual microphone devices are used to send audio to the meeting. Then can be created as blocking or non-blocking (see Daily.create_microphone_device()). A blocking device will wait until VirtualMicrophoneDevice.write_frames() finishes writing the given audio frames. In contrast, a non-blocking microphone will not wait.

NOTE: Virtual microphone devices emulate a hardware device and have the constraint that only one microphone can be active per process. You can select the active microphone through the input settings in CallClient.join() or CallClient.update_inputs(). However, it is possible to use a custom microphone audio track when also specifying the input settings.

The audio format used by virtual microphone devices is 16-bit linear PCM.

channels

Returns the number of channels (2 for stereo and 1 for mono) of this device.

Returns:

The number of channels

Return type:

int

name

Returns the device name.

Returns:

The virtual microphone device name

Return type:

str

sample_rate

Returns the sample rate of this device (e.g. 16000).

Returns:

The sample rate

Return type:

int

write_frames(frames, completion=None)

Writes audio frames to a virtual microphone device created with Daily.create_microphone_device(). For non-blocking devices, the completion callback will be called when the audio frames have been written.

If less than a multiple of 10ms worth of audio frames are provided on a blocking microphone, padding will be added up to the next multiple.

Parameters:
  • frames (bytestring) – A bytestring with the audio frames to write

  • completion (func) – An optional completion callback with one parameter: (int)

Returns:

The number of audio frames written

Return type:

int

class VirtualSpeakerDevice

This class represents a virtual speaker device. Virtual speaker devices are used to receive audio from the meeting. They can be created as blocking or non-blocking (see Daily.create_speakler_device()). Blocking means that calling VirtualSpeakerDevice.read_frames() behaves synchronously until all the given audio frames have been read. In contrast, non-blocking will behave asynchronously (i.e. it won’t wait).

NOTE: Virtual speaker devices emulate a hardware device and have the constraint that only one speaker can be active per process. You can select the active speaker with Daily.select_speaker_device().

The audio format used by virtual speaker devices is 16-bit linear PCM.

channels

Returns the number of channels (2 for stereo and 1 for mono) of this device.

Returns:

The number of channels

Return type:

int

name

Returns the device name.

Returns:

The virtual speaker device name

Return type:

str

read_frames(num_frames, completion=None)

Reads audio frames from a virtual speaker device created with Daily.create_speaker_device(). For non-blocking devices, the completion callback will be called when the audio frames have been read.

Parameters:
  • num_frames (int) – The number of audio frames to read

  • completion (func) – An optional completion callback with one parameter: (bytestring)

Returns:

The read audio frames as a bytestring, or an empty bytestring if no frames were read

Return type:

bytestring.

sample_rate

Returns the sample rate of this device (e.g. 16000).

Returns:

The sample rate

Return type:

int