Room Types
OpenTogetherTube supports two types of rooms:Temporary Rooms
Auto-generated UUID-based rooms that expire after inactivity. Perfect for quick watch sessions.
Permanent Rooms
Named rooms that persist in the database. Can be claimed by registered users for full control.
Creating Rooms
Generate a Temporary Room
Temporary rooms are created with auto-generated UUIDs and don’t require an account:Create a Permanent Room
Permanent rooms have custom names and persist in the database:Room names must be 3-32 characters, alphanumeric with hyphens, and globally unique.
Room Properties
Rooms maintain the following state:| Property | Type | Description |
|---|---|---|
name | string | Unique identifier for the room |
title | string | Display title shown to users |
description | string | Room description |
visibility | enum | public, unlisted, or private |
queueMode | enum | How videos are queued (manual, vote, loop, dj) |
currentSource | QueueItem | Currently playing video |
queue | VideoQueue | Upcoming videos |
isPlaying | boolean | Playback state |
playbackPosition | number | Current position in seconds |
playbackSpeed | number | Playback speed multiplier (default: 1.0) |
owner | User | Room owner (can be null) |
Room Lifecycle
Loading
Rooms are loaded on-demand when users connect:- Check in-memory cache - If already loaded in RoomManager
- Check Redis - Restore from Redis if recently active
- Check database - Load from permanent storage
- Create new - Initialize a fresh room instance
Unloading
Rooms unload automatically when:- No users connected for the configured timeout period
- Explicitly commanded by admin
- Server shutdown
Room Settings
Users with appropriate permissions can modify room settings:Visibility Options
- Public
- Unlisted
- Private
Visible in the public room list. Anyone can join.
Queue Modes
Manual Mode
Manual Mode
Videos play in the order they were added. Room moderators control playback.
Vote Mode
Vote Mode
Queue automatically reorders based on user votes. Most voted videos play first.
Loop Mode
Loop Mode
Videos are re-queued after playing, creating an infinite loop.
DJ Mode
DJ Mode
Current video restarts when finished. Perfect for music sessions.
Room Ownership
Claiming Ownership
Rooms without owners can be claimed by registered users:- Full permission control
- Promote/demote users to roles
- Configure advanced settings
- Permanently delete the room
Persistence
Rooms use a three-tier storage strategy:What’s Stored Where
| Storage | Data | TTL |
|---|---|---|
| Memory | Full room state, users, queue, playback | Until unloaded |
| Redis | Serialized room state | Configurable (default: 1 hour) |
| Database | Settings, permissions, ownership | Permanent |
API Reference
Get Room Info
Update Room Settings
Delete Room
Only room owners can permanently delete permanent rooms. Admin API key can unload any room.
Implementation Details
Room Class Structure
TheRoom class (located at server/room.ts:222) implements the core room logic:
State Synchronization
Rooms automatically sync state changes to all connected clients:Best Practices
Choose the Right Room Type
Use temporary rooms for one-time events, permanent rooms for recurring sessions.
Configure Queue Mode
Match queue mode to your use case:
vote for democratic control, manual for moderated content.Related Features
Permissions
Configure who can control playback and manage the room
Video Sync
Learn how real-time synchronization works
Vote Mode
Democratic queue management
SponsorBlock
Automatic sponsor segment skipping