How videosdk-live/videosdk-rtc-unity-sdk-example works
Main Components
• Unity Engine as the core runtime environment.
• Assets Folder: Contains several critical sub-components:
• Scenes (e.g., SampleScene.unity) – where the video conferencing UI and simulation take place.
• Scripts (e.g., GameManager.cs, meeting and callback implementation scripts) – handle meeting management, UI interactions, and integration logic.
• Plugins: Contains platform-specific configurations (Android Gradle templates, iOS integration hooks) as well as potential third-party code.
• Prefabs (e.g., Participant.prefab) – pre-built game objects for participants or UI elements.
• Utility scripts (including those in CrystalFramework/Utility) – containing helper methods or demos (like the SafeAreaDemo) which might be used to manage UI layout.
• Additional modules like Unity-Logs-Viewer (logging/reporting utility) to capture runtime messages.
External Dependencies & Integration Layers
• VideoSDK Package: Installed via a Git URL; it provides core functionality (Meeting object creation, join, participant callbacks, video streaming) for video conferencing.
• Android and iOS build configurations: Gradle templates for Android and instructions for linking iOS frameworks. These elements indicate separate build pipeline layers.
• Newtonsoft-json: Managed via Unity's Package Manager for JSON serialization support.
Relationships and Interactions
• The Meeting Manager/Sdk Initialization layer (via a singleton or static GetMeetingObject() call) initializes the VideoSDK and exposes methods for creating and joining meetings.
• UI Components (such as GameObjects with VideoSurface script, RawImage for video rendering, or custom prefabs) interact with the Meeting Manager. They receive callbacks on participant events and utilize VideoSurface to render video frames.
• Participant Management: Scripts capture callbacks when participants join or leave and then update the UI accordingly. The meeting object’s event handlers funnel these events.
• Build and Platform Integration: The Plugins and ProjectSettings directories provide hooks for integrating external SDK dependencies (Android/iOS SDKs). They ensure that the VideoSDK is properly linked during the build phase.
Architectural Patterns/Design Principles
• Separation of Concerns: UI (scenes and prefabs) is clearly separated from business logic (meeting management, callback handling).
• Modular Integration: The VideoSDK is integrated as a package and uses clear API methods (CreateMeetingId, Join, SetParticipant, etc.) – this modularity allows for replacing or updating the SDK with minimal changes to the UI.
• Event-Driven Communication: The design uses callbacks (for meeting creation, participant join/leave, stream enabling/disabling) to update the visual components in real time, emphasizing an event-driven architecture.