### Complete Live Streaming Example Source: https://docs.daily.co/docs/daily-js/guides/live-streaming A comprehensive example demonstrating how to join a call, start and stop live streaming, and handle all related events. This includes UI updates for stream status and button states. ```javascript const call = Daily.createCallObject(); await call.join({ url: 'https://your-domain.daily.co/room', token: 'OWNER_OR_STREAMING_ADMIN_TOKEN', }); const RTMP_URL = 'rtmps://live.example.com/app/your-stream-key'; document.getElementById('go-live').onclick = () => { call.startLiveStreaming({ rtmpUrl: RTMP_URL, width: 1280, height: 720, fps: 30, videoBitrate: 3000, layout: { preset: 'active-participant' }, }); }; document.getElementById('stop-live').onclick = () => { call.stopLiveStreaming(); }; call.on('live-streaming-started', () => { document.getElementById('go-live').disabled = true; document.getElementById('stop-live').disabled = false; }); call.on('live-streaming-updated', ({ state }) => { const status = document.getElementById('stream-status'); status.textContent = state === 'connected' ? '● Live' : '⚠ Reconnecting…'; }); call.on('live-streaming-stopped', () => { document.getElementById('go-live').disabled = false; document.getElementById('stop-live').disabled = true; }); call.on('live-streaming-error', ({ errorMsg }) => { alert(`Stream error: ${errorMsg}`); }); ``` -------------------------------- ### Clone and Install VCS SDK with Yarn Source: https://docs.daily.co/docs/vcs/installation Clone the Daily VCS GitHub repository and install JavaScript components using yarn. This is the initial setup step for local development. ```bash git clone https://github.com/daily-co/daily-vcs.git cd daily-vcs/js yarn install ``` -------------------------------- ### Start SIP Dial-out Call Example Source: https://docs.daily.co/docs/daily-js/advanced/dialin-dialout Example of initiating a SIP outbound call with specified codecs. ```typescript const { session } = await call.startDialOut({ sipUri: 'sip:conference@pbx.example.com', displayName: 'Conference Bridge', video: false, codecs: { audio: ['OPUS', 'G722'], }, }); ``` -------------------------------- ### Complete Screen Sharing Example Source: https://docs.daily.co/docs/daily-js/guides/screen-sharing This example demonstrates how to join a Daily call, start screen sharing with audio and excluding the browser tab, and stop screen sharing. It also includes event listeners for screen share state changes and handling picker dismissal. ```javascript const call = Daily.createCallObject(); await call.join({ url: 'https://your-domain.daily.co/room' }); const startBtn = document.getElementById('start-share'); const stopBtn = document.getElementById('stop-share'); startBtn.onclick = () => { call.startScreenShare({ displayMediaOptions: { audio: true, selfBrowserSurface: 'exclude' }, screenVideoSendSettings: 'detail-optimized', }); }; stopBtn.onclick = () => call.stopScreenShare(); call.on('local-screen-share-started', () => { startBtn.disabled = true; stopBtn.disabled = false; }); call.on('local-screen-share-stopped', () => { startBtn.disabled = false; stopBtn.disabled = true; }); call.on('local-screen-share-canceled', () => { console.log('Picker was dismissed.'); }); ``` -------------------------------- ### Running the Stretchbox Example Source: https://docs.daily.co/docs/vcs/layout-api This command opens the stretchbox example in your browser. The example demonstrates the two-pass layout principle with dynamic text content adaptation. ```bash yarn open-browser example:stretchbox ``` -------------------------------- ### Start a SIP video call with custom settings Source: https://docs.daily.co/reference/daily-js/instance-methods/start-dial-out Initiate a SIP video call with custom display name and advanced video settings. This example demonstrates configuring video codecs and resolution for the call. ```javascript const { session } = await call.startDialOut({ sipUri: 'sip:boardroom@example.com', video: true, displayName: 'Board Room', codecs: { video: ['H264'], audio: ['OPUS'] }, videoSettings: { width: 1280, height: 720, fps: 15, videoBitrate: 900 }, }); ``` -------------------------------- ### Set Audio Output Device Source: https://docs.daily.co/reference/daily-js/instance-methods/set-output-device-async This example demonstrates how to get a list of available audio output devices and then set the first one as the active output device for the call. ```javascript const devices = await call.enumerateDevices(); const speakers = devices.devices.filter((d) => d.kind === 'audiooutput'); await call.setOutputDeviceAsync({ outputDeviceId: speakers[0].deviceId }); ``` -------------------------------- ### Install Daily.js via yarn Source: https://docs.daily.co/docs/daily-js/installation Install the @daily-co/daily-js package using yarn. ```bash yarn add @daily-co/daily-js ``` -------------------------------- ### Testing connection quality with testConnectionQuality() Source: https://docs.daily.co/reference/daily-js/instance-methods/test-connection-quality This JavaScript example demonstrates how to use the testConnectionQuality() method. It starts the camera, obtains a video track, and then calls testConnectionQuality() with a specified duration. The results are then processed in a switch statement to provide feedback on the connection quality. ```javascript await call.startCamera(); const videoTrack = call.participants().local.tracks.video.persistentTrack; const results = await call.testConnectionQuality({ videoTrack, duration: 10 }); switch (results.result) { case 'aborted': console.log('Test aborted before data was gathered.'); break; case 'failed': console.warn('Unable to connect to TURN servers.'); break; case 'bad': console.warn('Poor connection. Try a different network.'); break; case 'warning': console.warn('Connection may be unstable.'); break; case 'good': default: console.log('Connection quality is good.'); } ``` -------------------------------- ### Install Daily.js via pnpm Source: https://docs.daily.co/docs/daily-js/installation Install the @daily-co/daily-js package using pnpm. ```bash pnpm add @daily-co/daily-js ``` -------------------------------- ### Get Network Stats Example Source: https://docs.daily.co/reference/daily-js/instance-methods/get-network-stats An example of how to call the getNetworkStats method and interpret its results. ```APIDOC ## getNetworkStats() ### Description Retrieves the current network state, reasons for any degradation, and detailed statistics. ### Method `call.getNetworkStats()` ### Parameters None ### Response #### Success Response Returns an object containing: - **networkState** (string): The current state of the network ('good', 'bad', etc.). - **networkStateReasons** (array): An array of strings indicating reasons for the current network state (e.g., 'sendPacketLoss', 'recvPacketLoss'). - **stats** (object): An object containing various network performance statistics. - **averageNetworkRoundTripTime** (number): The average round-trip time in seconds. - **latest** (object): Statistics from the latest measurement. - **audioRecvBitsPerSecond** (number): Received audio bitrate. - **audioRecvJitter** (number): Audio receive jitter. - **audioRecvPacketLoss** (number): Audio receive packet loss percentage. - **audioSendBitsPerSecond** (number): Sent audio bitrate. - **audioSendJitter** (number): Audio send jitter. - **audioSendPacketLoss** (number): Audio send packet loss percentage. - **availableOutgoingBitrate** (number): Available outgoing bitrate. - **networkRoundTripTime** (number): The most recent network round-trip time in seconds. - **recvBitsPerSecond** (number): Total received bitrate. - **sendBitsPerSecond** (number): Total sent bitrate. - **timestamp** (number): Timestamp of the latest statistics measurement. - **totalRecvPacketLoss** (number): Total receive packet loss percentage. - **totalSendPacketLoss** (number): Total send packet loss percentage. - **videoRecvBitsPerSecond** (number): Received video bitrate. - **videoRecvJitter** (number): Video receive jitter. - **videoRecvPacketLoss** (number): Video receive packet loss percentage. - **videoSendBitsPerSecond** (number): Sent video bitrate. - **videoSendJitter** (number): Video send jitter. - **videoSendPacketLoss** (number): Video send packet loss percentage. - **worstAudioRecvJitter** (number): Worst recorded audio receive jitter. - **worstAudioRecvPacketLoss** (number): Worst recorded audio receive packet loss percentage. - **worstAudioSendJitter** (number): Worst recorded audio send jitter. - **worstAudioSendPacketLoss** (number): Worst recorded audio send packet loss percentage. - **worstVideoRecvJitter** (number): Worst recorded video receive jitter. - **worstVideoRecvPacketLoss** (number): Worst recorded video receive packet loss percentage. - **worstVideoSendJitter** (number): Worst recorded video send jitter. - **worstVideoSendPacketLoss** (number): Worst recorded video send packet loss percentage. ### Request Example ```javascript const { networkState, networkStateReasons, stats } = await call.getNetworkStats(); ``` ### Response Example ```json { "networkState": "bad", "networkStateReasons": ["sendPacketLoss", "recvPacketLoss"], "threshold": "good", "quality": 37, "stats": { "averageNetworkRoundTripTime": 0.01992261904761905, "latest": { "audioRecvBitsPerSecond": 23050.048937297845, "audioRecvJitter": 0.026, "audioRecvPacketLoss": 0.15053763440860216, "audioSendBitsPerSecond": 30177.83704675053, "audioSendJitter": null, "audioSendPacketLoss": null, "availableOutgoingBitrate": 2889866, "networkRoundTripTime": 0.02, "recvBitsPerSecond": 1700344.1895481267, "sendBitsPerSecond": 1724499.7493844875, "timestamp": 1743011906315, "totalRecvPacketLoss": 0.11670020120724346, "totalSendPacketLoss": 0.08984375, "videoRecvBitsPerSecond": 1567291.2594309496, "videoRecvJitter": 0.036, "videoRecvPacketLoss": 0.10891089108910891, "videoSendBitsPerSecond": 1589251.349980054, "videoSendJitter": 0.008922, "videoSendPacketLoss": 0.08984375 }, "worstAudioRecvJitter": 0.026, "worstAudioRecvPacketLoss": 0.23232323232323232, "worstAudioSendJitter": 0.003166, "worstAudioSendPacketLoss": 0.1953125, "worstVideoRecvJitter": 0.036, "worstVideoRecvPacketLoss": 0.10891089108910891, "worstVideoSendJitter": 0.014355, "worstVideoSendPacketLoss": 0.13671875 } } ``` ``` -------------------------------- ### Open VCS Simulator with 'hello' example Source: https://docs.daily.co/docs/vcs/tools/simulator Launches the VCS Simulator with the 'hello' example composition. This command uses a shorthand for webpack's dev server configuration. ```bash yarn open-browser example:hello ``` -------------------------------- ### Start Camera and Preview Source: https://docs.daily.co/docs/daily-js/guides/audio-video Acquire device permissions and start the camera/mic pipeline before joining a room to display a preview and confirm device selection. ```javascript const devices = await call.startCamera(); console.log('Camera:', devices.camera); console.log('Mic:', devices.mic); // Later, join with camera already running await call.join({ url: 'https://your-domain.daily.co/room-name' }); ``` -------------------------------- ### Start Phone (PSTN) Dial-out Call Example Source: https://docs.daily.co/docs/daily-js/advanced/dialin-dialout Example of initiating a PSTN outbound call with caller ID, extension, and wait time for extension dialing. ```typescript const { session } = await call.startDialOut({ phoneNumber: '+15551234567', displayName: 'Jane Smith', callerId: '+18005551000', extension: '4321', waitBeforeExtensionDialSec: 3, }); ``` -------------------------------- ### Configuring Devices with startCamera() and Joining with join() Source: https://docs.daily.co/docs/daily-js/concepts/call-configuration Use `startCamera()` for initial device setup and preview, then pass the remaining call-specific options to `join()`. ```javascript // Device setup only await call.startCamera({ inputSettings: { audio: { processor: { type: 'noise-cancellation' } }, }, }); // Everything else at join time await call.join({ url: 'https://your-domain.daily.co/room-name', userName: 'Alice', token: meetingToken, }); ``` -------------------------------- ### Start a custom track with an explicit name Source: https://docs.daily.co/reference/daily-js/instance-methods/start-custom-track This example shows how to start sharing a custom MediaStreamTrack and provide a specific name for it. This is useful for identifying and managing custom tracks more easily. ```javascript const trackName = await call.startCustomTrack({ track: customTrack, trackName: 'cameraFeed2', }); ``` -------------------------------- ### Example Podfile with Daily Dependencies Source: https://docs.daily.co/docs/ios/installation An example of how your Podfile might look with the Daily and DailySystemBroadcast pods included. ```bash target 'MyApp' do pod 'Daily', '~> 0.37.0' # In case you wish to add support for screen sharing pod 'DailySystemBroadcast', '~> 0.37.0' end ``` -------------------------------- ### Build a Complete Device Switcher Source: https://docs.daily.co/docs/daily-js/guides/audio-video This example demonstrates how to enumerate available media devices and populate select elements for camera, microphone, and speaker. It also handles updates for hot-plugged devices. ```javascript async function buildDeviceSwitcher(call) { const { devices } = await call.enumerateDevices(); const camSelect = document.getElementById('camera-select'); const micSelect = document.getElementById('mic-select'); const spkSelect = document.getElementById('speaker-select'); // Populate selects for (const d of devices) { const opt = new Option(d.label || d.deviceId, d.deviceId); if (d.kind === 'videoinput') camSelect.append(opt.cloneNode(true)); if (d.kind === 'audioinput') micSelect.append(opt.cloneNode(true)); if (d.kind === 'audiooutput') spkSelect.append(opt.cloneNode(true)); } camSelect.onchange = () => call.setInputDevicesAsync({ videoDeviceId: camSelect.value }); micSelect.onchange = () => call.setInputDevicesAsync({ audioDeviceId: micSelect.value }); spkSelect.onchange = () => call.setOutputDeviceAsync({ outputDeviceId: spkSelect.value }); // Keep in sync with hot-plug events call.on('available-devices-updated', ({ availableDevices }) => { // Re-populate selects with the updated device list [camSelect, micSelect, spkSelect].forEach(s => (s.innerHTML = '')); for (const d of availableDevices) { const opt = new Option(d.label || d.deviceId, d.deviceId); if (d.kind === 'videoinput') camSelect.append(opt.cloneNode(true)); if (d.kind === 'audioinput') micSelect.append(opt.cloneNode(true)); if (d.kind === 'audiooutput') spkSelect.append(opt.cloneNode(true)); } }); } ``` -------------------------------- ### started-camera Event Object Source: https://docs.daily.co/reference/daily-js/events/settings-events Example of the event object emitted when a participant's camera starts. ```json { "action": "started-camera", "callClientId": "17225364729060.9442072768918943" } ``` -------------------------------- ### Complete Cloud Recording Example Source: https://docs.daily.co/docs/daily-js/guides/recording Demonstrates initiating a cloud recording with specific dimensions and layout, handling start/stop events, and updating the recording layout dynamically. ```javascript const call = Daily.createCallObject(); await call.join({ url: 'https://your-domain.daily.co/room' }); // Start a 1080p cloud recording with active-speaker layout call.startRecording({ type: 'cloud', width: 1920, height: 1080, fps: 30, layout: { preset: 'active-participant' }, }); call.on('recording-started', ({ recordingId }) => { console.log('Recording ID:', recordingId); recordingBadge.hidden = false; }); call.on('recording-stopped', () => { recordingBadge.hidden = true; }); call.on('recording-error', ({ errorMsg }) => { console.error('Recording failed:', errorMsg); }); // Switch layout mid-recording when a screen share starts call.on('local-screen-share-started', () => { call.updateRecording({ layout: { preset: 'single-participant', session_id: call.participants().local.session_id, }, }); }); call.on('local-screen-share-stopped', () => { call.updateRecording({ layout: { preset: 'active-participant' }, }); }); document.getElementById('stop-recording').onclick = () => call.stopRecording(); ``` -------------------------------- ### Start a custom track with an auto-generated name Source: https://docs.daily.co/reference/daily-js/instance-methods/start-custom-track This example demonstrates how to start sharing a custom MediaStreamTrack and let Daily.js automatically generate a unique name for it. The resolved track name is then logged to the console. ```javascript const trackName = await call.startCustomTrack({ track: customTrack }); console.log('Track started as:', trackName); // e.g. "customVideo0" ``` -------------------------------- ### TypeScript Setup and Basic Usage Source: https://docs.daily.co/docs/daily-js/installation Demonstrates how to import and use Daily.js with TypeScript, including creating a call object, handling events, and checking browser support. Ensure you have TypeScript configured in your project. ```typescript import Daily, { DailyCall, DailyParticipant, DailyEventObjectParticipants, DailyBrowserInfo, } from '@daily-co/daily-js'; // Factory methods return DailyCall const call: DailyCall = Daily.createCallObject(); // Event callbacks are fully typed call.on('joined-meeting', (event: DailyEventObjectParticipants) => { Object.values(event.participants).forEach((p: DailyParticipant) => { console.log(p.user_name, p.session_id); }); }); // Browser support check const info: DailyBrowserInfo = Daily.supportedBrowser(); if (!info.supported) { throw new Error('WebRTC not supported in this browser'); } ``` -------------------------------- ### Get Recording Info OpenAPI Specification Source: https://docs.daily.co/reference/rest-api/recordings/get-recording This OpenAPI 3.0.3 specification defines the GET /recordings/{recording_id} endpoint for retrieving recording details. It outlines parameters, request/response structures, and example data. ```yaml GET /recordings/{recording_id} openapi: 3.0.3 info: title: Daily API description: |- The Daily REST API offers the ability to manage the following: - Overall Domain Configuration - Individual Room creation and config management - Meeting token creation and validation - Recording and compositing management - Meeting analytics - Logs and metrics - Real-time presence Please reach out to help@daily.co if we can help with anything version: 1.1.1 contact: name: Daily url: https://docs.daily.co email: help@daily.co servers: - url: https://api.daily.co/v1 security: - bearerAuth: [] paths: /recordings/{recording_id}: get: tags: - recordings summary: recordings/:id description: Get info about a recording operationId: GetRecordingInfo parameters: - name: recording_id in: path required: true style: simple explode: false schema: type: string responses: '200': description: '200' content: application/json: schema: type: object properties: id: type: string example: 0cb313e1-211f-4be0-833d-8c7305b19902 description: >- A unique, opaque ID for this object. You can use this ID in API calls, and in paginated list operations. room_name: type: string description: The name of the [room](/reference/rest-api/rooms). start_ts: type: integer example: 1548789650 description: >- When the recording started. This is a unix timestamp (seconds since the epoch). status: type: string example: finished enum: - finished - in-progress - canceled max_participants: type: integer example: 2 description: >- The maximum number of participants that were ever in this room together during the meeting session that was recorded. duration: type: integer example: 277 description: >- How many seconds long the recording is, approximately. This property is not returned for recordings that are in-progress. share_token: type: string example: TivXjlD22QQt description: Deprecated. s3key: type: string example: mydomain/test-recording-room/11245260397 description: The S3 Key associated with this recording. mtgSessionId: type: string example: 257764e6-c74e-4c30-944a-a887a03173a3 description: The meeting session ID for this recording. tracks: type: array description: >- If the recording is a raw-tracks recording, a tracks field will be provided. If role permissions have been removed, the tracks field may be null. items: type: object properties: size: type: integer example: 15620 description: The size of the file. type: type: string example: audio enum: - audio - video description: The type of track file, audio or video. s3key: type: string example: mydomain/test-recording-room/11245260397-audio description: >- The S3 Key associated with this partiicular track file. examples: Result: value: id: 0cb313e1-211f-4be0-833d-8c7305b19902 start_ts: 1548789650 status: finished ``` -------------------------------- ### Start Live Stream Source: https://docs.daily.co/reference/rest-api/rooms/live-streaming Initiates a live stream for a specified room. Requires authentication and provides detailed configuration options for video, audio, layout, and data outputs. Use this to begin a cloud-based stream. ```bash curl --request POST \ --url https://api.daily.co/v1/rooms/{room_name}/live-streaming/start \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data \ '{ "width": 123, "height": 123, "fps": 123, "videoBitrate": 123, "audioBitrate": 123, "minIdleTimeOut": 123, "maxDuration": 123, "backgroundColor": "", "instanceId": "", "type": "cloud", "layout": { "preset": "default", "max_cam_streams": 123 }, "dataOutputs": [ "" ], "rtmpUrl": "", "endpoints": [ { "endpoint": "" } ] }' ``` -------------------------------- ### Get Room Presence OpenAPI Specification Source: https://docs.daily.co/reference/rest-api/rooms/session/get-presence This OpenAPI specification defines the GET /rooms/{room_name}/presence endpoint for retrieving a room's presence snapshot. It includes parameters for filtering and an example of the JSON response. ```yaml GET /rooms/{room_name}/presence openapi: 3.0.3 info: title: Daily API description: |- The Daily REST API offers the ability to manage the following: - Overall Domain Configuration - Individual Room creation and config management - Meeting token creation and validation - Recording and compositing management - Meeting analytics - Logs and metrics - Real-time presence Please reach out to help@daily.co if we can help with anything version: 1.1.1 contact: name: Daily url: https://docs.daily.co email: help@daily.co servers: - url: https://api.daily.co/v1 security: - bearerAuth: [] paths: /rooms/{room_name}/presence: get: tags: - rooms summary: rooms/:name/presence description: Get a presence snapshot for a room operationId: GetRoomPresence parameters: - name: room_name in: path description: The name of the room required: true style: simple explode: false schema: type: string - name: limit in: query description: Sets the number of participants returned. required: false style: form explode: true schema: type: integer format: int32 - name: userId in: query description: >- Returns presence for the user with the given userId, if available. The userId is specified via a [meeting token](/products/rest-api/meeting-tokens/config#user_id). required: false style: form explode: true schema: type: string - name: userName in: query description: Returns presence for the user with the given name, if available. required: false style: form explode: true schema: type: string responses: '200': description: '200' content: application/json: schema: $ref: '#/components/schemas/rooms-room_name_presence-get-res' examples: Result: value: total_count: 1 data: - room: w2pp2cf4kltgFACPKXmX id: d61cd7b2-a273-42b4-89bd-be763fd562c1 userId: pbZ+ismP7dk= userName: Moishe mtgSessionId: 16e9701a-93e0-4933-83c9-223e7c40d552 joinTime: '2023-01-01T20:53:19.000Z' duration: 2312 '400': $ref: '#/components/responses/400' deprecated: false security: - bearerAuth: [] components: schemas: rooms-room_name_presence-get-res: type: object properties: total_count: type: integer example: 192 data: type: array items: type: object properties: id: type: string example: d61cd7b2-a273-42b4-89bd-be763fd562c1 room: type: string example: w2pp2cf4kltgFACPKXmX userId: type: string example: pbZ+ismP7dk= userName: type: string example: Moishe mtgSessionId: type: string example: 16e9701a-93e0-4933-83c9-223e7c40d552 joinTime: type: string example: '2023-01-01T20:53:19.000Z' duration: type: integer format: int32 example: 2312 responses: '400': description: '400' content: application/json: schema: type: object properties: error: type: string info: type: string examples: Result: value: error: invalid-request-error info: missing required field securitySchemes: bearerAuth: type: http scheme: bearer ``` -------------------------------- ### Preview Devices Before Joining a Call with Daily.js Source: https://docs.daily.co/reference/daily-js/instance-methods/start-camera This snippet demonstrates how to use `startCamera()` to acquire camera and microphone access for a pre-join preview. It then shows how to access the local audio and video tracks and finally joins the call. ```javascript const call = Daily.createCallObject(); // Preview devices before joining await call.startCamera({ url: 'https://your-domain.daily.co/room-name' }); const { local } = call.participants(); const audioTrack = local.tracks.audio.track; const videoTrack = local.tracks.video.track; // Later, join the call when ready await call.join(); ``` -------------------------------- ### Open VCS Simulator with Daily's baseline composition Source: https://docs.daily.co/docs/vcs/tools/simulator Starts the VCS Simulator using Daily's default baseline composition, useful for developing custom components. ```bash yarn open-browser daily:baseline ``` -------------------------------- ### Grant Admin Permissions for Transcription Source: https://docs.daily.co/docs/daily-react/docs/permissions Example of granting a participant the ability to administer transcription, allowing them to start and stop it. ```jsx daily.updateParticipant(sessionId, { updatePermissions: { canAdmin: new Set(['transcription']), }, }); ``` -------------------------------- ### Authentication Example Source: https://docs.daily.co/docs/rest-api Demonstrates how to authenticate a GET request to the /rooms endpoint using an API key in the Authorization header. ```APIDOC ## GET /v1/rooms ### Description Fetches a list of rooms. This endpoint requires authentication. ### Method GET ### Endpoint https://api.daily.co/v1/rooms ### Authentication **Required**: Include your API key in the `Authorization` header. ```bash curl --request GET \ --url https://api.daily.co/v1/rooms \ --header "Authorization: Bearer DAILY_API_KEY" ``` ### Error Handling - **400**: Returned if the `Authorization` header is missing. - **401**: Returned if the provided API key is invalid. ``` -------------------------------- ### Full Dial-out Flow Example Source: https://docs.daily.co/docs/daily-js/advanced/dialin-dialout This example demonstrates a complete dial-out flow, including starting the call, handling connection and disconnection events, and ending the call. It also shows how to send DTMF tones to navigate IVR systems. ```typescript let activeSessionId: string | null = null; async function callPhoneNumber(phoneNumber: string) { try { const { session } = await call.startDialOut({ phoneNumber }); if (session) { activeSessionId = session.sessionId; } } catch (err) { console.error('Failed to start dial-out:', err); } } call.on('dialout-answered', ({ sessionId }) => { console.log('Call answered!'); updateUI({ status: 'connected', sessionId }); }); call.on('dialout-stopped', ({ sessionId }) => { if (sessionId === activeSessionId) { activeSessionId = null; updateUI({ status: 'idle' }); } }); call.on('dialout-error', ({ errorMsg, sessionId }) => { console.error(`Call failed: ${errorMsg}`); if (sessionId === activeSessionId) { activeSessionId = null; updateUI({ status: 'error', message: errorMsg }); } }); async function endCall() { if (activeSessionId) { await call.stopDialOut({ sessionId: activeSessionId }); } } // Send DTMF to navigate an IVR async function pressKey(key: string) { if (activeSessionId) { await call.sendDTMF({ sessionId: activeSessionId, tones: key, method: 'auto', }); } } ``` -------------------------------- ### Transcript Error Event Example Source: https://docs.daily.co/docs/rest-api/transcription Fired if an error occurs during transcription or before it could start. Includes an 'error' field with details. ```json { "version": "1.1.0", "type": "transcript.error", "payload": { "id": "8d5c03f3-cff3-43c7-b112-0f78989f659f", "room_name": "my-room", "status": "t_error", "error": "User is not authorized to perform: s3:PutObject on resource..." }, "event_ts": 1733234946.616 } ``` -------------------------------- ### startRecording() Source: https://docs.daily.co/reference/react-native/instance-methods/start-recording Starts a recording of a Daily call. This method is available on paid plans only. If server-side recording (`cloud`) is enabled for the room, it records all participants with active cameras and/or microphones. Devices that are off are not recorded. Recording must be enabled for the room. Multiple recording sessions can run concurrently if each is started with a unique `instanceId`. ```APIDOC ## startRecording(options?) ### Description Starts a recording of a Daily call. This method is available on paid plans only. If server-side recording (`cloud`) is enabled for the room, it records all participants with active cameras and/or microphones. Devices that are off are not recorded. Recording must be enabled for the room. Multiple recording sessions can run concurrently if each is started with a unique `instanceId`. ### Parameters `options?: DailyStreamingOptions` All fields are optional. See [`DailyStreamingOptions`](/reference/react-native/types/daily-streaming-options) for the full list of shared options: output quality (`width`, `height`, `fps`, `videoBitrate`, `audioBitrate`, `backgroundColor`), session lifetime (`instanceId`, `minIdleTimeOut`, `maxDuration`), output artifacts (`dataOutputs`), and `layout`. The `type` field is recording-specific: #### `type` (string) - Optional, default: `'cloud'` Recording type: * `'cloud'` — cloud recording with video composition (default) * `'cloud-audio-only'` — cloud recording, audio only; no video composition charges * `'raw-tracks'` — individual uncomposed audio/video tracks per participant ### Return value Returns `void`. Listen for [`recording-started`](/reference/react-native/events/recording-events#recording-started) to confirm the recording is active. ### Examples ```javascript // Start a cloud recording at 720p await call.startRecording({ width: 1280, height: 720, fps: 25, layout: { preset: 'default', max_cam_streams: 5, }, }); ``` #### Audio-only recording ```javascript await call.startRecording({ type: 'cloud-audio-only', }); ``` ```javascript await call.startRecording({ layout: { preset: 'audio-only', participants: { audio: ['user-id-of-participant-1', 'user-id-of-participant-2'], }, }, }); ``` #### Raw tracks (audio only) ```javascript await call.startRecording({ layout: { preset: 'raw-tracks-audio-only', }, }); ``` #### Custom layout with VCS baseline composition ```javascript await call.startRecording({ layout: { preset: 'custom', composition_id: 'daily:baseline', composition_params: { mode: 'dominant', 'videoSettings.preferScreenshare': true, }, session_assets: { 'images/logo': 'https://example.com/logo.png', }, }, }); ``` ``` -------------------------------- ### Start Cloud Recording with Defaults Source: https://docs.daily.co/docs/daily-js/guides/recording Initiates a cloud recording using default settings. Ensure recording is enabled on the room or token beforehand. ```javascript // Start a cloud recording with defaults call.startRecording(); ``` -------------------------------- ### Screen Share Unknown Error Example Source: https://docs.daily.co/reference/daily-js/events/error-events Fires when an unknown error occurs starting a screen share, such as an AbortError during shutdown. ```json { "action": "nonfatal-error", "callClientId": "17225364729060.9442072768918943", "type": "screen-share-error", "errorMsg": "Error starting ScreenShare: unknown", "details": { "category": "unknown", "browserError": { "name": "AbortError", "message": "In shutdown", "code": 20 } } } ``` -------------------------------- ### OpenAPI Specification for Get Individual Meeting Info Source: https://docs.daily.co/reference/rest-api/meetings/get-meeting This OpenAPI 3.0.3 specification defines the GET /meetings/{meeting} endpoint for retrieving individual meeting information. It outlines the request parameters, response structure, and provides an example of a successful response. ```yaml GET /meetings/{meeting} openapi: 3.0.3 info: title: Daily API description: |- The Daily REST API offers the ability to manage the following: - Overall Domain Configuration - Individual Room creation and config management - Meeting token creation and validation - Recording and compositing management - Meeting analytics - Logs and metrics - Real-time presence Please reach out to help@daily.co if we can help with anything version: 1.1.1 contact: name: Daily url: https://docs.daily.co email: help@daily.co servers: - url: https://api.daily.co/v1 security: - bearerAuth: [] paths: /meetings/{meeting}: get: tags: - meetings summary: /meetings/:meeting description: retrieve info about a particular meeting operationId: GetIndividualMeetingInfo parameters: - name: meeting in: path description: the ID of the meeting session required: true schema: type: string responses: '200': description: '200' content: application/json: schema: $ref: '#/components/schemas/meetings_meeting-get-res' examples: Result: value: id: d61cd7b2-a273-42b4-89bd-be763fd562c1 room: room-name start_time: 1672606399 duration: 2055 ongoing: false max_participants: 5 '400': $ref: '#/components/responses/400' deprecated: false security: - bearerAuth: [] components: schemas: meetings_meeting-get-res: type: object properties: id: type: string example: d61cd7b2-a273-42b4-89bd-be763fd562c1 room: type: string example: room-name start_time: type: integer example: 1672606399 duration: type: integer example: 2055 ongoing: type: boolean example: false max_participants: type: integer example: 4 responses: '400': description: '400' content: application/json: schema: type: object properties: error: type: string info: type: string examples: Result: value: error: invalid-request-error info: missing required field securitySchemes: bearerAuth: type: http scheme: bearer ``` -------------------------------- ### Start Cloud Recording with Explicit Options Source: https://docs.daily.co/docs/daily-js/guides/recording Starts a cloud recording with specified video and audio parameters, including resolution, bitrate, and background color. Recording must be enabled on the room or token. ```javascript // Start with explicit options call.startRecording({ type: 'cloud', width: 1920, height: 1080, fps: 30, videoBitrate: 4000, audioBitrate: 128, backgroundColor: '#000000', }); ``` -------------------------------- ### Transcript Started Event Example Source: https://docs.daily.co/docs/rest-api/transcription Fired when real-time transcription begins. Includes instance ID and S3 path if storage is enabled. ```json { "version": "1.1.0", "type": "transcript.started", "payload": { "id": "68f65d4c-a4dc-4179-bbb1-c12432afb924", "info": { "instanceId": "a1f2f6b7-b1ac-4202-85e5-d446cb6c3d3f" }, "room_name": "my-transcript-room", "mtg_session_id": "a2bc876d-2816-4732-9c87-01e0b8c0b01b", "status": "t_in_progress", "out_params": { "s3": { "key": "domain/room/1733234355482.vtt", "bucket": "daily-co-transcription-staging", "region": "us-west-2" } } }, "event_ts": 1733234355.505 } ``` -------------------------------- ### Start Recording with Custom Layout Source: https://docs.daily.co/docs/daily-js/guides/recording Starts a cloud recording with a fully custom layout using Daily's VCS baseline composition. Allows control over modes, overlays, labels, and participant ordering. ```javascript call.startRecording({ layout: { preset: 'custom', composition_id: 'daily:baseline', composition_params: { mode: 'dominant', 'videoSettings.showParticipantLabels': true, }, session_assets: { 'images/logo': 'https://example.com/logo.png', }, }, }); ``` -------------------------------- ### Initialize VCS Renderer Source: https://docs.daily.co/docs/vcs/tools/vcs-web-renderer Use the `startDOMOutputAsync` function to create and start a VCS renderer instance. This function requires a DOM element for rendering, viewport dimensions, initial media sources, and optional configuration settings. ```javascript startDOMOutputAsync( rootDOMElement, viewportWidth, viewportHeight, initialSources, options ); ``` -------------------------------- ### Screen Share Permissions Error Example Source: https://docs.daily.co/reference/daily-js/events/error-events Fires when an error occurs starting a screen share due to permissions being blocked by the browser. ```json { "action": "nonfatal-error", "callClientId": "17225364729060.9442072768918943", "type": "screen-share-error", "errorMsg": "Error starting ScreenShare: blocked-by-browser", "details": { "category": "permissions", "blockedBy": "browser", "browserError": { "name": "NotAllowedError", "message": "The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission." } } } ``` -------------------------------- ### Full Iframe Integration Example Source: https://docs.daily.co/call-object A comprehensive example demonstrating how to create an iframe, join a meeting, and handle events like 'joined-meeting'. ```javascript import Daily from '@daily-co/daily-js'; const call = Daily.createFrame( document.getElementById('call-container'), { url: 'https://your-domain.daily.co/hello', showLeaveButton: true, iframeStyle: { width: '100%', height: '100%', border: '0', }, } ); call.on('joined-meeting', (event) => { console.log('Joined!', event.participants); }); await call.join(); ``` -------------------------------- ### Listen for Live Streaming Events Source: https://docs.daily.co/docs/guides/features/live-streaming Listen for live streaming events such as 'live-streaming-started', 'live-streaming-updated', 'live-streaming-stopped', and 'live-streaming-error'. This example shows how to log when the stream starts. ```javascript call.on('live-streaming-started', (e) => console.log('live stream started', e)); ``` -------------------------------- ### Signaling Network Connection Connected Event Source: https://docs.daily.co/reference/daily-js/events/quality-events Example of a signaling connection being established. This event indicates the primary connection for call setup and management is active. ```json { "action": "network-connection", "type": "signaling", "event": "connected", "callClientId": "17225364729060.9442072768918943" } ``` -------------------------------- ### Start Live Stream (daily-python) Source: https://docs.daily.co/changelog/061-2024-10-17 Use this method in daily-python to initiate a live stream. Ensure the CallClient is properly initialized. ```python CallClient.start_live_stream() ``` -------------------------------- ### Start a PSTN call with extension Source: https://docs.daily.co/reference/daily-js/instance-methods/start-dial-out Initiate a PSTN call to a phone number, including a display name and an extension. This example shows how to specify an extension and a delay before dialing it. ```javascript const { session } = await call.startDialOut({ phoneNumber: '+12268077097', displayName: 'Support Line', extension: '1234', waitBeforeExtensionDialSec: 4, }); ```