### File Structure Overview (Directory Listing) Source: https://github.com/tanchunsiong/videosdk-windows-dotnet-desktop-framework-quickstart/blob/main/ZoomVideoSDK.WinForms/README.md This illustrates the project's directory structure, highlighting key folders like 'libs' for SDK DLLs and 'bin/Debug/net48' for output files including the configuration file. ```bash ZoomVideoSDK.WinForms/ ├── libs/ # Zoom VideoSDK DLLs (included in project) │ ├── videosdk.dll │ ├── libcrypto-3-zm.dll │ ├── libssl-3-zm.dll │ ├── turbojpeg.dll │ ├── SDL2.dll │ └── cares.dll ├── bin/Debug/net48/ # Output directory │ ├── config.json # Configuration file (copied automatically) │ ├── ZoomVideoSDK.WinForms.exe │ ├── ZoomVideoSDK.Wrapper.dll │ └── [All Zoom DLLs] └── [Source files] ``` -------------------------------- ### JWT Token Generation Payload Example (JSON) Source: https://github.com/tanchunsiong/videosdk-windows-dotnet-desktop-framework-quickstart/blob/main/ZoomVideoSDK.WinForms/README.md An example JSON payload structure for generating a JWT token for Zoom VideoSDK. This payload includes essential claims like issuer, expiration, audience, and session-specific details. ```json { "iss": "YOUR_API_KEY", "exp": 1735689600, "alg": "HS256", "aud": "zoom", "appKey": "YOUR_API_KEY", "tokenExp": 1735689600, "sessionName": "TestSession", "userIdentity": "TestUser", "sessionKey": "session123", "geoRegions": "US" } ``` -------------------------------- ### Session Configuration in JSON Source: https://context7.com/tanchunsiong/videosdk-windows-dotnet-desktop-framework-quickstart/llms.txt Defines the structure for reading session configuration from a JSON file. This file is located in the application directory and provides default values for session credentials in the UI. ```json { "SessionName": "MyVideoSession", "Token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJZT1VSX0FQSV9LRVkiLCJleHAiOjE3MzU2ODk2MDAsImFsZyI6IkhTMjU2IiwiYXVkIjoiem9vbSIsImFwcEtleSI6IllPVVJfQVBJX0tFWSIsInRva2VuRXhwIjoxNzM1Njg5NjAwLCJzZXNzaW9uTmFtZSI6Ik15VmlkZW9TZXNzaW9uIiwidXNlcklkZW50aXR5IjoiVGVzdFVzZXIiLCJzZXNzaW9uS2V5Ijoic2Vzc2lvbjEyMyIsImdlb1JlZ2lvbnMiOiJVUyJ9.xxxxx", "UserName": "TestUser", "Password": "optional_password" } ``` -------------------------------- ### Control Video Start/Stop in C# Source: https://context7.com/tanchunsiong/videosdk-windows-dotnet-desktop-framework-quickstart/llms.txt Manages the local video stream during a Zoom Video SDK session. It includes starting and stopping the video feed, checking if video is already running to prevent duplicate actions, and handling incoming video frames for local preview and remote participants. ```csharp zoomSDK.PreviewVideoReceived += (sender, e) => { pictureBoxSelf.Image?.Dispose(); pictureBoxSelf.Image = new Bitmap(e.Frame); }; zoomSDK.RemoteVideoReceived += (sender, e) => { pictureBoxRemote.Image?.Dispose(); pictureBoxRemote.Image = new Bitmap(e.Frame); }; if (!zoomSDK.IsVideoStarted()) { bool started = zoomSDK.StartVideo(); if (started) { Console.WriteLine("Video started - preview frames will arrive via events"); } } bool stopped = zoomSDK.StopVideo(); if (stopped) { Console.WriteLine("Video stopped successfully"); pictureBoxSelf.Image = null; } ``` -------------------------------- ### Initialize and Join Zoom Session in C# Source: https://github.com/tanchunsiong/videosdk-windows-dotnet-desktop-framework-quickstart/blob/main/README.md Demonstrates the basic steps to initialize the Zoom Video SDK, join a session with provided credentials, and set up event handling for session status changes. This requires the ZoomSDKManager class, which is part of the C++/CLI wrapper. ```csharp using System; // Assuming ZoomSDKManager is available from the C++/CLI wrapper // using ZoomVideoSDK.Wrapper; public class ZoomSessionManager { private ZoomSDKManager sdkManager; public ZoomSessionManager() { sdkManager = new ZoomSDKManager(); } public bool InitializeSDK() { // Initialize the SDK bool initialized = sdkManager.Initialize(); if (initialized) { Console.WriteLine("Zoom SDK initialized successfully."); // Subscribe to session status changes sdkManager.SessionStatusChanged += HandleSessionStatusChanged; } else { Console.WriteLine("Failed to initialize Zoom SDK."); } return initialized; } public bool JoinSession(string sessionName, string token, string userName, string password = null) { // Join a session bool joined = sdkManager.JoinSession( sessionName: sessionName, token: token, userName: userName, password: password ); if (joined) { Console.WriteLine($"Successfully joined session: {sessionName}"); } else { Console.WriteLine($"Failed to join session: {sessionName}"); } return joined; } public void LeaveSession() { // Leave session when done sdkManager.LeaveSession(); Console.WriteLine("Left session."); // Unsubscribe from events if necessary sdkManager.SessionStatusChanged -= HandleSessionStatusChanged; } private void HandleSessionStatusChanged(object sender, SessionStatusEventArgs e) // Assuming SessionStatusEventArgs is defined { Console.WriteLine($"Session Status Changed: Status = {e.Status}, Message = {e.Message}"); // Handle different status updates (e.g., connected, disconnected, error) } // Placeholder for SessionStatusEventArgs if not provided elsewhere public class SessionStatusEventArgs : EventArgs { public string Status { get; set; } public string Message { get; set; } } // Placeholder for ZoomSDKManager if not provided elsewhere public class ZoomSDKManager { public event EventHandler SessionStatusChanged; public bool Initialize() { /* ... SDK initialization logic ... */ return true; } public bool JoinSession(string sessionName, string token, string userName, string password) { /* ... Join session logic ... */ return true; } public void LeaveSession() { /* ... Leave session logic ... */ } } } ``` -------------------------------- ### Manage Audio and Video Devices in C# Source: https://context7.com/tanchunsiong/videosdk-windows-dotnet-desktop-framework-quickstart/llms.txt Enumerates and selects audio and video devices such as microphones, speakers, and cameras using the Zoom SDK. Device lists are populated after SDK initialization and can be refreshed. This code populates UI elements like combo boxes. ```csharp // Get available device lists string[] microphones = zoomSDK.GetMicrophoneList(); string[] speakers = zoomSDK.GetSpeakerList(); string[] cameras = zoomSDK.GetCameraList(); // Display available devices Console.WriteLine("Available Microphones:"); foreach (var mic in microphones) { Console.WriteLine($" - {mic}"); } Console.WriteLine("\nAvailable Speakers:"); foreach (var speaker in speakers) { Console.WriteLine($" - {speaker}"); } Console.WriteLine("\nAvailable Cameras:"); foreach (var camera in cameras) { Console.WriteLine($" - {camera}"); } // Populate UI combo boxes microphoneComboBox.Items.Clear(); foreach (var mic in microphones) { microphoneComboBox.Items.Add(mic); } if (microphoneComboBox.Items.Count > 0) { microphoneComboBox.SelectedIndex = 0; } ``` -------------------------------- ### Initialize Zoom Video SDK in C# Source: https://context7.com/tanchunsiong/videosdk-windows-dotnet-desktop-framework-quickstart/llms.txt Initializes the Zoom Video SDK, which is a prerequisite for performing any session operations. This involves loading native SDK libraries and setting up session management. It subscribes to status change events to log initialization status. ```csharp var zoomSDK = new ZoomSDKInterop(); zoomSDK.StatusChanged += (sender, message) => { Console.WriteLine($"SDK Status: {message}"); }; bool initialized = zoomSDK.Initialize(); if (initialized) { Console.WriteLine("Zoom SDK initialized successfully"); } else { Console.WriteLine("Failed to initialize Zoom SDK"); } ``` -------------------------------- ### Leave Zoom Video SDK Session in C# Source: https://context7.com/tanchunsiong/videosdk-windows-dotnet-desktop-framework-quickstart/llms.txt Leaves the current Zoom Video SDK session. Before disconnecting, it ensures that the video stream is stopped if it is currently active. The method returns a boolean indicating the success of the leave operation. ```csharp if (zoomSDK.IsInSession) { bool left = zoomSDK.LeaveSession(); if (left) { Console.WriteLine("Leave session initiated successfully"); } else { Console.WriteLine("Failed to leave session"); } } ``` -------------------------------- ### C++/CLI Wrapper Interface for Zoom Video SDK Source: https://context7.com/tanchunsiong/videosdk-windows-dotnet-desktop-framework-quickstart/llms.txt This C++/CLI code defines the interface for the ZoomSDKManager, acting as a bridge between native Zoom Video SDK and .NET applications. It exposes methods for SDK initialization, session management, audio/video controls, and device enumeration, along with event handlers for status changes and video frames. ```cpp // ZoomSDKManager.h - Key interface members namespace ZoomVideoSDKWrapper { // Session status enumeration public enum class SessionStatus { Idle, Joining, InSession, Leaving, Reconnecting, Failed, Error }; public ref class ZoomSDKManager { public: // Events for .NET consumers event EventHandler^ SessionStatusChanged; event EventHandler^ RemoteVideoReceived; event EventHandler^ PreviewVideoReceived; // SDK lifecycle bool Initialize(); void Cleanup(); // Session management bool JoinSession(String^ sessionName, String^ token, String^ userName, String^ password); void LeaveSession(); // Audio controls bool MuteAudio(bool mute); bool IsAudioMuted(); // Video controls bool StartVideo(); bool StopVideo(); bool IsVideoStarted(); bool IsCurrentUserVideoOn(); // Device enumeration array^ GetMicrophoneList(); array^ GetSpeakerList(); array^ GetCameraList(); bool SelectMicrophone(String^ deviceId); bool SelectSpeaker(String^ deviceId); bool SelectCamera(String^ deviceId); // Properties property bool IsInSession { bool get(); } property bool IsInitialized { bool get(); } property String^ CurrentSessionName { String^ get(); } }; } ``` -------------------------------- ### Join Zoom Video SDK Session in C# Source: https://context7.com/tanchunsiong/videosdk-windows-dotnet-desktop-framework-quickstart/llms.txt Joins a Zoom Video SDK session using a session name, JWT token, and optional password. It subscribes to session-related events such as successful joining, errors, and leaving. The method returns a boolean indicating if the join attempt was initiated. ```csharp zoomSDK.SessionJoined += (sender, e) => { Console.WriteLine("Successfully joined the session!"); }; zoomSDK.SessionError += (sender, errorMessage) => { Console.WriteLine($"Session error: {errorMessage}"); }; zoomSDK.SessionLeft += (sender, e) => { Console.WriteLine("Left the session"); }; string sessionName = "MyVideoSession"; string jwtToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."; string userName = "John Doe"; string password = "optional_password"; bool success = zoomSDK.JoinSession(sessionName, jwtToken, userName, password); if (success) { Console.WriteLine("Join session initiated - waiting for connection..."); } else { Console.WriteLine("Failed to initiate session join"); } ``` -------------------------------- ### JWT Token Payload Structure for Zoom SDK Source: https://context7.com/tanchunsiong/videosdk-windows-dotnet-desktop-framework-quickstart/llms.txt Illustrates the required JSON payload structure for generating JWT tokens used in authenticating with the Zoom Video SDK. Key fields include API key, expiration time, session name, and user identity. ```json { "iss": "YOUR_API_KEY", "exp": 1735689600, "alg": "HS256", "aud": "zoom", "appKey": "YOUR_API_KEY", "tokenExp": 1735689600, "sessionName": "MyVideoSession", "userIdentity": "TestUser", "sessionKey": "session123", "geoRegions": "US" } ``` -------------------------------- ### Control Audio Mute State in C# Source: https://context7.com/tanchunsiong/videosdk-windows-dotnet-desktop-framework-quickstart/llms.txt Manages the microphone mute state within an active Zoom Video SDK session. It allows checking the current mute status and toggling it between muted and unmuted states. The operation's success is indicated by a boolean return value. ```csharp bool isMuted = zoomSDK.IsAudioMuted(); Console.WriteLine($"Current audio state: {(isMuted ? "Muted" : "Unmuted")}"); bool newMuteState = !isMuted; bool success = zoomSDK.MuteAudio(newMuteState); if (success) { Console.WriteLine($"Microphone {(newMuteState ? "muted" : "unmuted")} successfully"); } else { Console.WriteLine("Failed to change microphone state"); } ``` -------------------------------- ### C# Windows Forms UI and SDK Event Handling Source: https://context7.com/tanchunsiong/videosdk-windows-dotnet-desktop-framework-quickstart/llms.txt This C# code snippet shows a Windows Forms application integrating with the Zoom Video SDK. It handles SDK initialization, session joining, video control, and various SDK events like session status changes and video frame reception. It relies on a ZoomSDKInterop class for SDK interactions. ```csharp public partial class MainForm : Form { private ZoomSDKInterop _zoomSDK; private bool _isInSession = false; private bool _isVideoStarted = false; public MainForm() { InitializeComponent(); InitializeZoomSDK(); } private void InitializeZoomSDK() { _zoomSDK = new ZoomSDKInterop(); // Set up all event handlers _zoomSDK.SessionJoined += (s, e) => { _isInSession = true; UpdateUIState(); UpdateStatus("Successfully joined session"); }; _zoomSDK.SessionLeft += (s, e) => { _isInSession = false; _isVideoStarted = false; UpdateUIState(); ClearVideoDisplays(); }; _zoomSDK.SessionError += (s, error) => { MessageBox.Show($"Session error: {error}", "Error"); }; _zoomSDK.StatusChanged += (s, message) => { UpdateStatus(message); }; _zoomSDK.PreviewVideoReceived += (s, e) => { if (e.Frame != null) { _selfVideoPanel.Image?.Dispose(); _selfVideoPanel.Image = new Bitmap(e.Frame); } }; _zoomSDK.RemoteVideoReceived += (s, e) => { if (e.Frame != null) { _remoteVideoPanel.Image?.Dispose(); _remoteVideoPanel.Image = new Bitmap(e.Frame); } }; // Initialize SDK if (_zoomSDK.Initialize()) { PopulateDeviceLists(); UpdateStatus("SDK ready"); } } private void JoinButton_Click(object sender, EventArgs e) { string sessionName = _sessionNameTextBox.Text.Trim(); string token = _tokenTextBox.Text.Trim(); string userName = _userNameTextBox.Text.Trim(); string password = _passwordTextBox.Text.Trim(); if (string.IsNullOrEmpty(sessionName) || string.IsNullOrEmpty(token) || string.IsNullOrEmpty(userName)) { MessageBox.Show("Please fill in all required fields"); return; } _zoomSDK.JoinSession(sessionName, token, userName, password); } private void StartVideoButton_Click(object sender, EventArgs e) { if (_zoomSDK.StartVideo()) { _isVideoStarted = true; UpdateUIState(); } } protected override void OnFormClosing(FormClosingEventArgs e) { if (_zoomSDK != null) { if (_zoomSDK.IsInSession) _zoomSDK.LeaveSession(); _zoomSDK.Cleanup(); } base.OnFormClosing(e); } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.