### Clone Example Project Source: https://docs.videosdk.live/ios/guide/interactive-live-streaming/custom-template Clone the VideoSDK quickstart repository to get started with custom templates. ```bash git clone https://github.com/videosdk-live/quickstart.git ``` -------------------------------- ### Install Frontend Dependencies and Start Server Source: https://docs.videosdk.live/ai_agents/ai-agent-quickstart-react Installs the necessary Node.js dependencies and starts the React development server. Access the application at http://localhost:3000. ```bash # Install dependencies npm install # Start the development server npm start ``` -------------------------------- ### Clone Example Project Source: https://docs.videosdk.live/android/guide/interactive-live-streaming/custom-template Clone the provided GitHub repository to get started with the custom template example. ```bash git clone https://github.com/videosdk-live/quickstart.git ``` -------------------------------- ### Setup Environment Variables Source: https://docs.videosdk.live/ai_agents/agent-runtime/connect-agent/mobile-integrations/agent-starter-flutter Copy the example environment file and update it with your VideoSDK credentials and agent details. ```bash cp .env.example .env ``` ```env AUTH_TOKEN=your_videosdk_auth_token AGENT_ID=your_agent_id MEETING_ID=your_meeting_id VERSION_ID=your_version_id ``` -------------------------------- ### Setup Environment Variables Source: https://docs.videosdk.live/ai_agents/agent-runtime/connect-agent/mobile-integrations/agent-starter-android Copy the example properties file and update it with your VideoSDK credentials and agent details. ```bash cp local.properties.example local.properties ``` ```properties authToken=your_videosdk_auth_token agentId=your_agent_id meetingId=your_meeting_id versionId=your_version_id ``` -------------------------------- ### Project Structure Example Source: https://docs.videosdk.live/react/guide/video-and-audio-calling-api-sdk/quick-start-ILS An example of the expected project structure after setting up the React application and installing the SDK. ```jsx root ├── node_modules ├── public ├── src │ ├── API.js │ ├── App.js │ ├── index.js ├── package.json . . ``` -------------------------------- ### Setup Virtual Environment and Install Dependencies Source: https://docs.videosdk.live/api-reference/realtime-communication/server-side-examples-python Create a virtual environment to manage project dependencies and install the required packages using pip. ```bash python -m venv env source env/bin/activate pip install -r requirements.txt ``` -------------------------------- ### Install and Run Custom Template Manager Source: https://docs.videosdk.live/react/guide/interactive-live-streaming/custom-template Navigate to the custom template manager directory, install dependencies, and start the application. ```bash cd react-custom-template-manager npm install npm run start ``` -------------------------------- ### Run Development Server Source: https://docs.videosdk.live/javascript/guide/video-and-audio-calling-api-sdk/run-a-sample-javascript-project Start the sample application using 'live-server' on port 8000. Ensure 'live-server' is installed globally. ```bash live-server --port=8000 ``` -------------------------------- ### Clone the sample project Source: https://docs.videosdk.live/ios/guide/video-and-audio-calling-api-sdk/run-a-sample-ils-project Clone the repository to your local environment to get started with the sample project. ```bash $ git clone https://github.com/videosdk-live/videosdk-ils-iOS-sdk-example.git ``` -------------------------------- ### Example Usage Source: https://docs.videosdk.live/javascript/guide/interactive-live-streaming/integrate-hls/start-hls Demonstrates how to initialize a meeting and start HLS with a specific configuration when a button is clicked. ```APIDOC ## Example Implementation This example shows how to set up an event listener for a button click to start the HLS stream with predefined configurations. ### Code ```javascript let meeting; // Initialize Meeting meeting = VideoSDK.initMeeting({ // ... other initialization options }); const startHlsBtn = document.getElementById("startHlsBtn"); startHlsBtn.addEventListener("click", () => { // Start HLS with configuration meeting?.startHls({ layout: { type: "GRID", priority: "SPEAKER", gridSize: 4, }, theme: "DARK", mode: "video-and-audio", quality: "high", orientation: "landscape", }); }); ``` ``` -------------------------------- ### Environment Variables Setup Source: https://docs.videosdk.live/python/guide/video-and-audio-calling/stream-ingestion/custom-audio-track Ensure your environment variables for VideoSDK authentication are set up before running the example. ```bash VIDEOSDK_TOKEN = "" MEETING_ID = "" NAME = "" ``` -------------------------------- ### Full Realtime Transcription Example Source: https://docs.videosdk.live/python/guide/video-and-audio-calling/transcription-and-summary/realtime-transcribe-meeting A complete example demonstrating how to initialize VideoSDK, join a meeting, start transcription with summary, and stop it after a duration. Includes event handling for transcription state and text. ```python import asyncio from videosdk import ( MeetingConfig, VideoSDK, MeetingEventHandler, SummaryConfig, TranscriptionConfig ) VIDEOSDK_TOKEN = "" MEETING_ID = "" NAME = "" loop = asyncio.get_event_loop() class MyMeetingEventHandler(MeetingEventHandler): def on_transcription_state_changed(self, data): print(f"===== transcription state changed -> {data} =====") def on_transcription_text(self, data): print(f"===== transcription text -> {data} =====") async def main(): meeting = VideoSDK.init_meeting(**MeetingConfig( meeting_id=MEETING_ID, name=NAME, mic_enabled=True, webcam_enabled=True, token=VIDEOSDK_TOKEN, )) meeting.add_event_listener(MyMeetingEventHandler()) meeting.join() await asyncio.sleep(5) meeting.start_transcription(TranscriptionConfig( summary=SummaryConfig( enabled=True, prompt="Write summary in sections like Title, Agenda, Speakers, Action Items, Outlines, Notes and Summary" ) )) await asyncio.sleep(60) meeting.stop_transcription() if __name__ == "__main__": loop.run_until_complete(main()) loop.run_forever() ``` -------------------------------- ### Minimal Worker Setup Source: https://docs.videosdk.live/ai_agents/deployments/self-hosting/worker-configuration Provides the simplest Worker setup for getting started. Ensure `your_agent_function` is defined elsewhere. ```python from videosdk.agents import WorkerJob, Options, JobContext, RoomOptions options = Options( agent_id="MyAgent", max_processes=5, register=True, # Registers worker with the backend for job scheduling ) room_options = RoomOptions( name="My Agent", ) job_context = JobContext(room_options=room_options) job = WorkerJob( entrypoint=your_agent_function, jobctx=lambda: job_context, options=options, ) job.start() ``` -------------------------------- ### Clone Custom Recording Template Example Source: https://docs.videosdk.live/android/guide/video-and-audio-calling-api-sdk/live-streaming/custom-template Clone this repository to get started with custom recording templates. ```bash git clone https://github.com/videosdk-live/videosdk-custom-recording-template-js-example.git ``` -------------------------------- ### Run the Sample App Source: https://docs.videosdk.live/ai_agents/agent-runtime/connect-agent/web-integrations/agent-starter-react Start the development server to run the React Agent Starter application. ```bash npm run dev #or yarn dev ``` -------------------------------- ### Run the Sample App Source: https://docs.videosdk.live/react/guide/video-and-audio-calling-api-sdk/run-a-sample-react-hls-project Start the sample application using npm. ```bash npm run start ``` -------------------------------- ### Run the Sample App Source: https://docs.videosdk.live/react/guide/video-and-audio-calling-api-sdk/run-a-sample-react-ils-project Start the sample React application using npm. ```bash npm run start ``` -------------------------------- ### Livestream Started Webhook Example Source: https://docs.videosdk.live/api-reference/realtime-communication/user-webhooks This webhook is fired when the livestream is successfully started. ```json { "webhookType": "livestream-started", "data": { "meetingId": "jvsg-8rjn-j304", "sessionId": "613731342f27f56e4fc4b6d0" } } ``` -------------------------------- ### Start and Stop Recording Example Source: https://docs.videosdk.live/react-native/guide/interactive-live-streaming/recording/recording A React Native component demonstrating how to start and stop a live stream recording using the `useMeeting` hook. Includes example configurations for recording and post-transcription. ```javascript import { useMeeting } from "@videosdk.live/react-native-sdk"; import { TouchableOpacity, Text, View } from "react-native"; const MeetingView = () => { const { startRecording, stopRecording } = useMeeting(); const handleStartRecording = () => { // Configuration for recording const config = { layout: { type: "GRID", priority: "SPEAKER", gridSize: 4, }, theme: "DARK", mode: "video-and-audio", quality: "high", orientation: "landscape", }; // Configuration for post transcription let transcription = { enabled: true, summary: { enabled: true, prompt: "Write summary in sections like Title, Agenda, Speakers, Action Items, Outlines, Notes and Summary", }, }; // Start Recording // If you don't have a `webhookUrl` or `awsDirPath`, you should pass null. startRecording( "YOUR WEB HOOK URL", "AWS Directory Path", config, transcription ); }; const handleStopRecording = () => { // Stop Recording stopRecording(); }; return ( Start Recording Stop Recording ); }; ``` -------------------------------- ### ESP32 VideoSDK Integration Quickstart Source: https://docs.videosdk.live/iot/guide/video-and-audio-calling-api-sdk/quickstart/quick-start This is the main application entry point for an ESP32 project using the VideoSDK. It initializes the SDK, connects to the network, creates a meeting, and manages audio streams. Ensure you replace GENRERATED_TOKEN and MEETING_ID with your actual credentials and desired meeting ID. ```c #include #include #include #include #include #include #include "esp_event.h" #include "esp_log.h" #include "esp_mac.h" #include "esp_netif.h" #include "esp_partition.h" #include "esp_system.h" #include "freertos/FreeRTOS.h" #include "mdns.h" #include "nvs_flash.h" #include "protocol_examples_common.h" #include "videosdk.h" static const char *TAG = "VideoSDK"; // Logging tag const char *token = "GENRERATED_TOKEN"; // Your VideoSDK Authentication token const char *meetingId = "MEETING_ID" ; // Task to create a meeting using the VideoSDK static void meeting_task(void *pvParameters) { create_meeting_result_t result = create_meeting(token); // Create meeting using IoT SDK if (result.room_id) { ESP_LOGI(TAG, "Created meeting roomId = %s", result.room_id); meetingId = result.room_id; // Set global meetingId` free(result.room_id); // Free allocated memory } else { ESP_LOGE(TAG, "Failed to create meeting"); } ESP_LOGI(TAG, "meeting_task finished, deleting self"); vTaskDelete(NULL); // Delete task after completion } void app_main(void) { static char deviceid[32] = {0}; // Buffer to hold device ID uint8_t mac[8] = {0}; // MAC address buffer ESP_LOGI(TAG, "[APP] Startup.."); ESP_LOGI(TAG, "[APP] Free memory: %d bytes", esp_get_free_heap_size()); ESP_LOGI(TAG, "[APP] IDF version: %s", esp_get_idf_version()); // Configure logging levels esp_log_level_set("*", ESP_LOG_INFO); esp_log_level_set("esp-tls", ESP_LOG_VERBOSE); esp_log_level_set("MQTT_CLIENT", ESP_LOG_VERBOSE); esp_log_level_set("MQTT_EXAMPLE", ESP_LOG_VERBOSE); esp_log_level_set("TRANSPORT_BASE", ESP_LOG_VERBOSE); esp_log_level_set("TRANSPORT", ESP_LOG_VERBOSE); esp_log_level_set("OUTBOX", ESP_LOG_VERBOSE); // Initialize system components ESP_ERROR_CHECK(nvs_flash_init()); ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); ESP_ERROR_CHECK(example_connect()); // Generate unique device ID from MAC address of your esp if (esp_read_mac(mac, ESP_MAC_WIFI_STA) == ESP_OK) { sprintf(deviceid, "esp32-%02x%02x%02x%02x%02x%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); ESP_LOGI(TAG, "Device ID: %s", deviceid); } // Create a task to handle meeting creation BaseType_t ok = xTaskCreate(meeting_task, "meeting_task", 16384, (void *)token, 5, NULL); if (ok != pdPASS) { ESP_LOGE(TAG, "Failed to create meeting_task"); } // Initialize VideoSDK configuration init_config_t init_cfg = { .meetingID = meetingId, .token = token, .displayName = "ESP32_Device", .audioCodec = AUDIO_CODEC_OPUS, }; result_t init_result = init(&init_cfg); // Initialize SDK with config printf("Result: %d\n", init_result); // Start publishing audio stream result_t result_publish = startPublishAudio("your-publisherId"); // Start subscribing to an audio stream result_t result_susbcribe = startSubscribeAudio("your-subscriberId","your-subscriberToId"); // Keep the session active for a defined duration (adjust as per your application use case) vTaskDelay(pdMS_TO_TICKS(100000)); // Leave the meeting result_t result_leave = leave(); printf("Result:%d\n", result_susbcribe); // Keep main loop alive while (1) { vTaskDelay(pdMS_TO_TICKS(10)); } } ``` -------------------------------- ### HLS Started Webhook Example Source: https://docs.videosdk.live/api-reference/realtime-communication/user-webhooks This event is fired when HLS encoding has started for a meeting. ```json { "webhookType": "hls-started", "data": { "meetingId": "jvsg-8rjn-j304", "sessionId": "613731342f27f56e4fc4b6d0", "playbackHlsUrl": "https://cdn.videosdk.live/meetings-hls/b8a770ef-d713-4a27-9ab7-e5a0b724caaf/index.m3u8" } } ``` -------------------------------- ### Run the Sample App Source: https://docs.videosdk.live/react-native/guide/video-and-audio-calling-api-sdk/run-a-sample-react-native-project Start the development server and run the sample app on Android or iOS. ```bash npm run start npm android npm ios ``` -------------------------------- ### Clone VideoSDK RTC API Server Examples Repo Source: https://docs.videosdk.live/api-reference/realtime-communication/server-side-examples-dotnet Clone the repository to get the .NET example code. Navigate into the JWT example directory. ```bash git clone https://github.com/videosdk-live/videosdk-rtc-api-server-examples.git cd dotnet/jwt-example ``` -------------------------------- ### Full Example: Create and Initialize Meeting - C Source: https://docs.videosdk.live/iot/guide/video-and-audio-calling-api-sdk/audio-call/setup-call/init-meeting A complete example demonstrating how to create a meeting ID using a token and then initialize the VideoSDK client with meeting details. It includes error handling for meeting creation and configuration for display name and audio codec. ```c void app_main(void) { /*This function allow us to create a Meeting ID with the help of the token and on passing the wrong token it returns an error "Failed to created meeting" */ char * token = "Generated token from Dashboard/API"; create_meeting_result_t result = create_meeting(token); if (room_id) { ESP_LOGI(TAG, "Created meeting roomId = %s", result.room_id); free(result.room_id); } else { ESP_LOGE(TAG, "Failed to create meeting"); } /* this function allow us to create a meeting by authenticating the meetingID, token, audioCodec and dislayName */ init_config_t init_cfg = { .meetingID = "your meeting id ", .token = "your metting id npm run dev", .displayName = "ESP32-Device", .audioCodec = AUDIO_CODEC_PCMA, }; init(&init_cfg); while (1) { vTaskDelay(pdMS_TO_TICKS(10)); } } ``` -------------------------------- ### Session Started Webhook Example Source: https://docs.videosdk.live/api-reference/realtime-communication/user-webhooks This webhook is called when a new meeting session is successfully started. It provides the session ID, meeting ID, and the start time. ```json { "webhookType": "session-started", "data": { "sessionId": "613731342f27f56e4fc4b6d0", "meetingId": "jvsg-8rjn-j304", "start": "2022-07-05T15:55:35.047+00:00" } } ``` -------------------------------- ### Clone the sample project Source: https://docs.videosdk.live/react/guide/video-and-audio-calling-api-sdk/run-a-sample-react-hls-project Clone the repository to your local environment to start. ```bash git clone https://github.com/videosdk-live/videosdk-hls-react-sdk-example.git ``` -------------------------------- ### Run the Sample App Source: https://docs.videosdk.live/react-native/guide/video-and-audio-calling-api-sdk/run-a-sample-react-native-ils-project Start the sample application and run it on your Android or iOS device. ```bash npm run start npm android npm ios ``` -------------------------------- ### useTranscription Example Source: https://docs.videosdk.live/react/api/sdk-reference/use-transcription Example demonstrating how to use the useTranscription hook to start and stop real-time transcription with configuration options. ```APIDOC ## useTranscription example useTranscription react hook ```javascript import { Constants, useTranscription } from "@videosdk.live/react-sdk"; function onTranscriptionStateChanged(data) { const { status, id } = data; if (status === Constants.transcriptionEvents.TRANSCRIPTION_STARTING) { console.log("Realtime Transcription is starting", id); } else if (status === Constants.transcriptionEvents.TRANSCRIPTION_STARTED) { console.log("Realtime Transcription is started", id); } else if (status === Constants.transcriptionEvents.TRANSCRIPTION_STOPPING) { console.log("Realtime Transcription is stopping", id); } else if (status === Constants.transcriptionEvents.TRANSCRIPTION_STOPPED) { console.log("Realtime Transcription is stopped", id); } } function onTranscriptionText(data) { let { participantId, participantName, text, timestamp, type } = data; console.log(`${participantName}: ${text} ${timestamp}`); } const { startTranscription, stopTranscription } = useTranscription({ onTranscriptionStateChanged, onTranscriptionText, }); ``` #### Example ```javascript const { startTranscription, stopTranscription } = useTranscription(); const run = async () => { await startTranscription({ webhookUrl: "https://www.example.com", summary: { enabled: true, prompt: "Write summary in sections like Title, Agenda, Speakers, Action Items, Outlines, Notes and Summary", }, }); await stopTranscription(); }; run(); ``` ``` -------------------------------- ### Initialize and Join Meeting Source: https://docs.videosdk.live/android-sdk-reference/index.html Quick start guide to initialize the VideoSDK, configure authentication, and create/join a meeting. Ensure initialization is done once. ```kotlin // 1. Initialize the SDK (once, in your Application or Activity) VideoSDK.initialize(applicationContext) // 2. Set your authentication token VideoSDK.config("YOUR_TOKEN") // 3. Create and join a meeting val meeting = VideoSDK.initMeeting( context, // Android context "meetingId", // meeting ID "John Doe", // display name true, // mic enabled true, // webcam enabled null, // participant ID (auto-generated) "SEND_AND_RECV", // mode true, // multi-stream (simulcast) null, // metadata null // signaling base URL ) meeting.join() ``` -------------------------------- ### User Data Script for EC2 Instance Setup Source: https://docs.videosdk.live/ai_agents/deployments/self-hosting/hosting-environments/aws-ec2 This script automates the setup process on a new EC2 instance. It installs necessary packages, clones your agent repository, installs dependencies, and configures a systemd service for the agent worker. ```bash #!/bin/bash yum update -y yum install -y python3 python3-pip git # Clone private repository with token git clone https://YOUR_TOKEN@github.com/your-org/your-agent.git /opt/agent cd /opt/agent # Install dependencies pip3 install -r requirements.txt # Create systemd service cat > /etc/systemd/system/agent-worker.service << EOF [Unit] Description=VideoSDK Agent Worker After=network.target [Service] Type=simple User=ec2-user WorkingDirectory=/opt/agent Environment=VIDEOSDK_AUTH_TOKEN=your_auth_token ExecStart=/usr/bin/python3 main.py Restart=always [Install] WantedBy=multi-user.target EOF # Start the service systemctl enable agent-worker systemctl start agent-worker ``` -------------------------------- ### Run the application Source: https://docs.videosdk.live/prebuilt/guide/prebuilt-video-and-audio-calling/using-npm Start the application to verify the prebuilt meeting in the browser. This command assumes you have a start script configured in your package.json. ```bash $ npm start ``` -------------------------------- ### Install Dependencies and Run Python Agent Source: https://docs.videosdk.live/ai_agents/ai-agent-quickstart-react-native Commands to install the necessary Python libraries for the agent and start the agent script. ```bash pip install videosdk-agents pip install "videosdk-plugins-google" python agent-react-native.py ``` -------------------------------- ### Example Usage Source: https://docs.videosdk.live/python/guide/video-and-audio-calling/handling-media/mute-unmute-mic Demonstrates how to initialize the VideoSDK, join a meeting, and then toggle microphone mute/unmute functionality. ```python import asyncio from videosdk import MeetingConfig, VideoSDK VIDEOSDK_TOKEN = "" MEETING_ID = "" NAME = "" loop = asyncio.get_event_loop() async def main(): meeting_config = MeetingConfig( meeting_id=MEETING_ID, name=NAME, mic_enabled=True, webcam_enabled=True, token=VIDEOSDK_TOKEN, ) meeting = VideoSDK.init_meeting(**meeting_config) print("joining into meeting...") await meeting.async_join() await asyncio.sleep(5) print("disable mic...after 5 seconds...") meeting.disable_mic() await asyncio.sleep(5) print("enable mic...after 5 seconds...") meeting.enable_mic() print("done") if __name__ == "__main__": loop.run_until_complete(main()) loop.run_forever() ``` -------------------------------- ### Start and Stop RTMP Livestream Source: https://docs.videosdk.live/javascript/guide/video-and-audio-calling-api-sdk/live-streaming/rtmp-livestream This example demonstrates how to start and stop an RTMP livestream using the `startLivestream()` and `stopLivestream()` methods. It includes basic configuration for layout and theme when starting the stream. ```javascript let meeting; // Initialize Meeting meeting = VideoSDK.initMeeting({ // ... }); const startLivestreamBtn = document.getElementById("startLivestreamBtn"); startLivestreamBtn.addEventListener("click", () => { // Start Livestream meeting?.startLivestream( [ { url: "rtmp://a.rtmp.youtube.com/live2", streamKey: "key", }, ], { layout: { type: "GRID", priority: "SPEAKER", gridSize: 4, }, theme: "DARK", }, { enabled: true, summary: { enabled: true, prompt: "Write summary in sections like Title, Agenda, Speakers, Action Items, Outlines, Notes and Summary", }, } ); }); const stopLivestreamBtn = document.getElementById("stopLivestreamBtn"); stopLivestreamBtn.addEventListener("click", () => { // Stop Livestream meeting?.stopLivestream(); }); ``` -------------------------------- ### Start Realtime Transcription Source: https://docs.videosdk.live/api-reference/realtime-communication/start-realtime-transcription This section details how to start a realtime transcription. It includes authentication requirements and example requests in various languages. ```APIDOC ## Start Realtime Transcription ### Description Initiates a realtime transcription service. This operation requires authentication using a JWT token. ### Method POST ### Endpoint `/v2/transcription/start` ### Headers - **Authorization** (string) - Required - Your JWT token. This token should be generated using VideoSDK ApiKey and Secret, and passed without any prefix like "Basic " or "Bearer ". ### Request Example (cURL) ```bash curl -X POST \ https://api.videosdk.live/v2/transcription/start \ -H 'Authorization: YOUR_TOKEN_WITHOUT_ANY_PREFIX' ``` ### Request Example (Node.js) ```javascript const options = { method: "POST", headers: { "Authorization": "YOUR_TOKEN_WITHOUT_ANY_PREFIX" } }; const url= `https://api.videosdk.live/v2/transcription/start`; const response = await fetch(url, options); const data = await response.json(); console.log(data); ``` ### Request Example (PHP) ```php 'https://api.videosdk.live/v2/transcription/start', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_HTTPHEADER => array( 'Authorization: YOUR_TOKEN_WITHOUT_ANY_PREFIX' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ?> ``` ### Request Example (Python) ```python import requests url = "https://api.videosdk.live/v2/transcription/start" headers = { "Authorization": "YOUR_TOKEN_WITHOUT_ANY_PREFIX" } response = requests.request('POST', url, headers=headers) print(response.text) ``` ### Response #### Success Response (200) (Response structure not provided in source) ``` -------------------------------- ### Initialize SDK and OpenAI Client Source: https://docs.videosdk.live/python/guide/video-and-audio-calling/ai-and-ml/vision-ai Import necessary modules, load environment variables, initialize the VideoSDK and OpenAI clients, and set up global variables. ```python import base64 import asyncio import os from videosdk import MeetingConfig, VideoSDK, Stream, Participant, Meeting, MeetingEventHandler, ParticipantEventHandler, PubSubPublishConfig from openai import OpenAI from PIL import Image from io import BytesIO from dotenv import load_dotenv load_dotenv() VIDEOSDK_TOKEN = os.getenv("VIDEOSDK_TOKEN") MEETING_ID = os.getenv("MEETING_ID") NAME = os.getenv("NAME") OPENAI_API_KEY = os.getenv("OPENAI_API_KEY") openai_client = OpenAI(api_key=OPENAI_API_KEY) loop = asyncio.get_event_loop() meeting: Meeting = None participant: Participant = None task: asyncio.Task = None ``` -------------------------------- ### Main Python Script Setup Source: https://docs.videosdk.live/telephony/ai-telephony-agent-quick-start Initializes the AI agent, imports necessary modules, sets up logging, and loads environment variables. ```python import asyncio import traceback from videosdk.agents import Agent, AgentSession, Pipeline, JobContext, RoomOptions, WorkerJob, Options from videosdk.plugins.google import GeminiRealtime, GeminiLiveConfig from dotenv import load_dotenv import os import logging logging.basicConfig(level=logging.INFO) load_dotenv() ``` -------------------------------- ### Clone VideoSDK RTC API Server Examples Repository Source: https://docs.videosdk.live/api-reference/realtime-communication/server-side-examples-rust Clone the repository to get the server examples. Navigate into the cloned directory. ```bash git clone https://github.com/videosdk-live/videosdk-rtc-api-server-examples.git cd rust ``` -------------------------------- ### Initialize Live Stream with Async Functions Source: https://docs.videosdk.live/javascript/guide/interactive-live-streaming/setup-livestream/initialize-livestream This example demonstrates initializing a live stream by first fetching the authentication token and stream ID asynchronously. It then configures the VideoSDK with the token and initializes the meeting. ```javascript // imports import { VideoSDK } from "@videosdk.live/js-sdk"; const getToken = async () => { ... }; const getStreamId = async () => { ... }; async function startLiveStream() { const token = await getToken(); const streamId = await getStreamId(); // Configure authentication token VideoSDK.config(token); // Initialise meeting liveStream = VideoSDK.initMeeting({ meetingId: meetingId, name: "YOUR_NAME", micEnabled: true, webcamEnabled: true, }); } ``` -------------------------------- ### Install Dependencies and Run React Native App Source: https://docs.videosdk.live/ai_agents/ai-agent-quickstart-react-native Commands to install project dependencies and start the React Native application for Android and iOS. ```bash npm install # Android npm run android # iOS (macOS only) cd ios && pod install && cd .. npm run ios ``` -------------------------------- ### Run the Application Source: https://docs.videosdk.live/docs/guide/prebuilt-video-and-audio-calling/using-npm Start the application to verify the prebuilt meeting integration in the browser. This command assumes you have a start script configured in your package.json. ```bash $ npm start ``` -------------------------------- ### Install Dependencies and Run Python AI Agent Source: https://docs.videosdk.live/ai_agents/ai-agent-quickstart-unity Execute these commands in your terminal to install the necessary Python packages and start the AI agent. ```bash # Install Python dependencies pip install videosdk-agents "videosdk-plugins-google" # Run the AI agent python agent-unity.py ``` -------------------------------- ### Run Your Application Source: https://docs.videosdk.live/javascript/guide/video-and-audio-calling-api-sdk/quick-start Use this command to serve your application locally. Ensure you have live-server installed globally. ```bash live-server --port=8000 ``` -------------------------------- ### Clone VideoSDK RTC API Server Examples Repository Source: https://docs.videosdk.live/api-reference/realtime-communication/server-side-examples-php Clone the repository to get the server examples. Navigate into the PHP directory after cloning. ```bash git clone https://github.com/videosdk-live/videosdk-rtc-api-server-examples.git cd php ``` -------------------------------- ### Start and Stop Recording with Full Configuration - React Source: https://docs.videosdk.live/react/guide/video-and-audio-calling-api-sdk/recording/record-meeting Implement start and stop recording functionality within a React component. This example shows how to configure recording parameters and handle the start and stop actions. ```javascript import { useMeeting } from "@videosdk.live/react-sdk"; const MeetingView = () => { const { startRecording, stopRecording } = useMeeting(); const handleStartRecording = () => { // Configuration for recording const config = { layout: { type: "GRID", priority: "SPEAKER", gridSize: 4, }, theme: "DARK", mode: "video-and-audio", quality: "high", orientation: "landscape", }; // Configuration for post transcription let transcription = { enabled: true, summary: { enabled: true, prompt: "Write summary in sections like Title, Agenda, Speakers, Action Items, Outlines, Notes and Summary", }, }; // Start Recording // If you don't have a `webhookUrl` or `awsDirPath`, you should pass null. startRecording( "YOUR WEB HOOK URL", "AWS Directory Path", config, transcription ); }; const handleStopRecording = () => { // Stop Recording stopRecording(); }; return ( <> ); }; ``` -------------------------------- ### Example Output of Agent Initialization Source: https://docs.videosdk.live/ai_agents/deployments/agent-cloud/cli/init-agent This output shows the typical progress and success messages when initializing a deployment, including the next recommended step. ```bash $ videosdk agent init --name my-agent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Initializing Deployment ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ⠋ Initializing Deployment... ✓ Deployment initialized successfully ℹ Next step: Build your agent Docker image videosdk agent build --image /: ``` -------------------------------- ### Live Stream Screen Example Source: https://docs.videosdk.live/flutter/guide/interactive-live-streaming/recording/recording Example widget demonstrating how to integrate start and stop recording buttons within a Flutter application's UI. ```dart import 'package:flutter/material.dart'; import 'package:videosdk/videosdk.dart'; class LiveStreamScreen extends StatefulWidget { ... } class _LiveStreamScreenState extends State { late Room _room; @override void initState() { ... } @override Widget build(BuildContext context) { return Column( children:[ ElevatedButton( onPressed:(){ Map config = { "layout": { "type": "GRID", "priority": "SPEAKER", "gridSize": 4, }, "theme": "DARK", "mode": "video-and-audio", "quality": "high", "orientation": "portrait", }; Map transcription = { "enabled": true, "summary": { "enabled": true, "prompt": "Write summary in sections like Title, Agenda, Speakers, Action Items, Outlines, Notes and Summary", } }; _room.startRecording(config: config, transcription: transcription); }, child: const Text("Start Recording"), ), ElevatedButton( onPressed:(){ _room.stopRecording(); }, child: const Text("Stop recording"), ), ] ); } } ``` -------------------------------- ### Install and Run Live Server (Node.js) Source: https://docs.videosdk.live/prebuilt/guide/prebuilt-video-and-audio-calling/using-script Install the live-server package globally and run it to serve your HTML file. Access the meeting through your web browser at the specified port. ```bash npm install -g live-server $ live-server --port=8000 ``` -------------------------------- ### Clone VideoSDK RTC API Server Examples Repository Source: https://docs.videosdk.live/api-reference/realtime-communication/server-side-examples-java Clone the repository to get the Java server example code. Navigate into the cloned directory. ```bash git clone https://github.com/videosdk-live/videosdk-rtc-api-server-examples.git cd java ``` -------------------------------- ### Set Up Main App Entry Point Source: https://docs.videosdk.live/ios/guide/video-and-audio-calling-api-sdk/quick-start-ios-hls Configure the main application entry point to display the StartMeetingView. This is essential for launching the meeting interface. ```swift import SwiftUI @main struct quick_start_ios_hls: App { var body: some Scene { WindowGroup { StartMeetingView() } } } ``` -------------------------------- ### Initialize VideoSDK in MainApplication Source: https://docs.videosdk.live/android/guide/video-and-audio-calling-api-sdk/quick-start-compose-ui Create a MainApplication class that extends Application and initializes the VideoSDK. Store your generated token in the sampleToken field. ```kotlin import android.app.Application import live.videosdk.rtc.android.VideoSDK class MainApplication: Application() { val sampleToken = "YOUR_TOKEN" //paste your token here override fun onCreate() { super.onCreate() VideoSDK.initialize(applicationContext) } } ``` -------------------------------- ### Send Session Start Event Source: https://docs.videosdk.live/agent-sdk-reference/plugins-aws Initiates a session by sending a session start event with inference configuration. This is part of the initial setup for a real-time interaction. ```python session_start_payload = { "event": { "sessionStart": { "inferenceConfiguration": { "maxTokens": self.config.max_tokens, "topP": self.config.top_p, "temperature": self.config.temperature, } } } } await self._send_event(json.dumps(session_start_payload)) ``` -------------------------------- ### Start and Stop Livestream Buttons Source: https://docs.videosdk.live/flutter/guide/video-and-audio-calling-api-sdk/live-streaming/rtmp-livestream Example of creating UI buttons to trigger the start and stop livestream functionalities. Ensure the `room` object is properly initialized. ```dart import 'package:flutter/material.dart'; import 'package:videosdk/videosdk.dart'; class MeetingScreen extends StatefulWidget { ... } class _MeetingScreenState extends State { late Room _room; @override void initState() { ... } @override Widget build(BuildContext context) { return Column( children:[ ElevatedButton( onPressed:(){ var outputs = [ { url: "rtmp://a.rtmp.youtube.com/live2", streamKey: "", }, { url: "rtmps://", streamKey: "", }, ]; var liveStreamConfig = { 'layout': { 'type': 'GRID', 'priority': 'SPEAKER', 'gridSize': 4, }, 'theme': "LIGHT", }; room.startLivestream(outputs, config: livestreamConfig); }, child: const Text("Start Livestream"), ), ElevatedButton( onPressed:(){ _room.stopLivestream(); }, child: const Text("Stop Livestream"), ), ] ); } } ``` -------------------------------- ### AI Deployment Session Started Webhook Example Source: https://docs.videosdk.live/api-reference/realtime-communication/user-webhooks This webhook is received when an AI deployment session starts and enters the 'Running' state. It includes the session ID. ```javascript { "webhookType": "ai-deployment-session-started", "data": { "sessionId": "session-5bf19efa-22af-41d8-8a3f-b4dbd3f8bcac" } } ``` -------------------------------- ### AI Deployment Session Starting Webhook Example Source: https://docs.videosdk.live/api-reference/realtime-communication/user-webhooks This webhook is received when an AI deployment session starts and enters the 'Queued' state. It includes the session ID. ```javascript { "webhookType": "ai-deployment-session-starting", "data": { "sessionId": "session-5bf19efa-22af-41d8-8a3f-b4dbd3f8bcac" } } ``` -------------------------------- ### Start Recording Request (Python) Source: https://docs.videosdk.live/api-reference/realtime-communication/start-recording A Python example using the 'requests' library to start a recording. It defines the URL, headers, and JSON payload for the POST request. ```python import requests url = "https://api.videosdk.live/v2/recordings/start" headers = {'Authorization' : '$YOUR_TOKEN','Content-Type' : 'application/json'} payload = { "roomId" : "abcd-efgh-ijkl", "templateUrl" : "https://www.example.com/?token=token&meetingId=74v5-v21l-n1ey&participantId=RECORDER_ID", "transcription" : "transcriptionObj", "config" : "configObj", "webhookUrl" : "https://www.example.com/", "awsDirPath" : "s3path", "preSignedUrl" : "preSignedUrl" } response = requests.request('POST',url,headers=headers,json=payload) print(response.text) ``` -------------------------------- ### Set Up Python Virtual Environment and Install Dependencies Source: https://docs.videosdk.live/ai_agents/ai-phone-agent-quick-start Create and activate a virtual environment for your project and install necessary packages from requirements.txt. Ensure you activate the correct environment for your operating system. ```bash # Create the virtual environment python3 -m venv .venv # Activate it (macOS/Linux) source .venv/bin/activate # On Windows, use: .venv\Scripts\activate # Install the required packages pip install -r requirements.txt ``` -------------------------------- ### Start Livestream Request (Python) Source: https://docs.videosdk.live/api-reference/realtime-communication/start-livestream Use the Python requests library to send a POST request to start a livestream. The payload is a dictionary that gets JSON encoded. ```python import requests url = "https://api.videosdk.live/v2/livestreams/start" headers = {'Authorization' : '$YOUR_TOKEN','Content-Type' : 'application/json'} payload = { "roomId" : "xyz", "outputs" : "[{ streamKey: 'Platform_StreamKey', url: 'RTMP-URL' }]", "transcription" : "transcriptionObj", "config" : "configObj", "templateUrl" : "https://www.example.com/?token=token&meetingId=74v5-v21l-n1ey&participantId=RECORDER_ID" } response = requests.request('POST',url,headers=headers,json=payload) print(response.text) ``` -------------------------------- ### Configure and Initialize VideoSDK Meeting Source: https://docs.videosdk.live/ios/api/sdk-reference/setup Import the VideoSDK, configure it with your server token, and then initialize a meeting with specified parameters. Ensure you replace placeholder values with your actual token, meeting ID, and participant details. ```swift import VideoSDK // Configure token, fetch it via auth API VideoSDK.config(token: ) // Intialize meeting let meeting = VideoSDK.initMeeting( meetingId: , participantId: , // optional participantName: , micEnabled: true, webcamEnabled: true) ``` -------------------------------- ### Run the Application Source: https://docs.videosdk.live/flutter/guide/sip-connect/quick-start Start the application locally on port 3000 after completing the configuration. ```bash npm run dev ``` -------------------------------- ### Clone VideoSDK RTC API Server Examples Repository Source: https://docs.videosdk.live/api-reference/realtime-communication/server-side-examples-python Clone the official repository to get the server example code. Navigate into the Python directory after cloning. ```bash git clone https://github.com/videosdk-live/videosdk-rtc-api-server-examples.git cd python ```