Module Organization
The library follows a modular design with clear separation of concerns:Core API Layer
The main public API is exposed through these core classes:- JitsiMeetJS.ts - Main library entry point exposing the public API
- JitsiConnection.ts - XMPP connection management and authentication
- JitsiConference.js - Video conference session representation
- JitsiParticipant.ts - Conference participant abstraction
- JitsiTrack/JitsiLocalTrack/JitsiRemoteTrack - Media track management
RTC Module (/modules/RTC/)
Handles all WebRTC functionality:
- Core WebRTC features: Track management and screen sharing
- TraceablePeerConnection.js - Enhanced PeerConnection with debugging capabilities
- RTCUtils.js - Browser compatibility and WebRTC utilities
XMPP Module (/modules/xmpp/)
Implements XMPP/Jingle protocol for signaling:
- ChatRoom.js - Multi-user chat room with presence management
- JingleSessionPC.js - Jingle protocol for media negotiation
- SignalingLayerImpl.js - Abstraction layer for signaling
- Strophe plugins - Protocol extensions (disco, ping, stream-management, etc.)
strophe.js as the XMPP client library.
E2EE Module (/modules/e2ee/)
Provides end-to-end encryption:
- End-to-end encryption using insertable streams and SFrame
- Worker.js - Web worker for E2EE processing (separate webpack entry)
- OlmAdapter.js - Integration with Olm for key management
Quality Control Module (/modules/qualitycontrol/)
Manages video quality and codec selection:
- Video quality adaptation and codec selection
- ReceiveVideoController/SendVideoController - Stream management
Service Layer (/service/)
Provides type-safe constants and events:
- Type-safe constants, events, and enums
- Well-defined event system used throughout the library
Architecture Layers
Signaling vs Media Layers
lib-jitsi-meet maintains a clean separation between two fundamental layers: Signaling Layer (XMPP)- Handles session establishment and negotiation
- Manages participant presence and room membership
- Coordinates media capabilities between peers
- Uses XMPP with Jingle extensions
- Supports both BOSH and WebSocket transports
- Manages actual media streams (audio/video)
- Handles peer-to-peer connections when applicable
- Controls media quality and bandwidth
- Processes media through the TraceablePeerConnection
Event-Driven Architecture
The library extensively uses the EventEmitter pattern throughout all modules:- Consistent event handling across all components
- Typed events defined in the
/service/directory - Event parameters and timing documented in JSDoc comments
- State change notifications for all significant operations
Common Event Patterns
All major classes follow this pattern:- Connection Events:
CONNECTION_ESTABLISHED,CONNECTION_FAILED,CONNECTION_DISCONNECTED - Conference Events:
CONFERENCE_JOINED,USER_JOINED,TRACK_ADDED - Track Events:
TRACK_MUTE_CHANGED,TRACK_AUDIO_LEVEL_CHANGED - Media Events:
REMOTE_TRACK_ADDED,LOCAL_TRACK_STOPPED
Design Patterns
Protocol Abstraction
Clean separation between XMPP signaling and WebRTC media:- SignalingLayerImpl provides an abstraction for signaling operations
- XMPP details are hidden behind higher-level APIs
- WebRTC integration uses TraceablePeerConnection for enhanced debugging
Modular Design
- Self-contained modules with minimal cross-dependencies
- Clear interfaces between components
- Consistent error handling and reporting across modules
Browser Compatibility
- webrtc-adapter integration for cross-browser support
- RTCUtils abstraction for capability detection
- Feature detection rather than browser detection where possible
Build Architecture
The library supports dual output formats:- UMD bundle (
dist/umd/) - For browser<script>tags - ESM modules (
dist/esm/) - For modern module bundlers
The library is actively migrating from JavaScript to TypeScript. New features should be implemented only with TypeScript, using strict type checking and avoiding
any, unknown, and object types.Development Patterns
TypeScript Migration
- 4-space indentation, LF line endings
- TypeScript enums for constant groups
- Interfaces for major components
- Strict type checking enabled in
tsconfig.json
Testing Strategy
- Tests located alongside source files with
.spec.tsextension - Karma + Jasmine testing framework
- Tests for both success and error scenarios
- Mocked external dependencies (XMPP connections, WebRTC APIs)
Next Steps
JitsiConnection
Learn about XMPP connection lifecycle and authentication
JitsiConference
Understand conference sessions and room management
Media Tracks
Explore local and remote media track handling
Participants
Work with participant properties and roles