## Overview
The Popup Player provides a dedicated, single-stream viewing window that can switch between Live and Playback modes.
It is designed for operators who need a larger, distraction-free view of one camera, while still being able to review recordings without returning to the grid.
This player is typically opened from the Views interface using Open in popup, and receives the target stream via a URL query parameter.

<div class="page-break" style="page-break-before: always;"></div>
## Functionality
### Mode Indicator and Switching
At the top of the window, the header displays:
- A mode badge:
- LIVE (red) when viewing real-time video
- PLAYBACK (grey) when reviewing recordings
- A toggle button that switches between modes:
- Switch to Playback (from Live)
- Switch to Live (from Playback)
Switching mode does not change the selected source; it only changes how the source is presented.

### Focus Stage (Main Content Area)
The main stage shows one of the following depending on state:
#### Missing Source Handling
If the stream identifier is missing from the URL, the player shows a clear message:
- “Missing source id (src)”
This prevents an empty/blank player state and indicates that the window was opened without a valid stream reference.
#### Live Mode
When in Live mode, the player loads the Live Video Player component for the requested source:
- Dedicated live monitoring window
- Streaming-mode selection (if enabled)
- Audio controls (if supported)
- PTZ controls (if supported)
- Recording and telemetry overlays (if enabled)
#### Playback Mode
When in Playback mode, the player loads the Playback Video Player component:
- Recording range selection (From/To)
- Timeline with segment blocks
- Pan/zoom navigation
- Speed and stepping controls
- Automatic segment chaining when recordings end
The playback player is initialized using a dedicated internal video element identifier to avoid conflicts with grid tiles.
## Workflow
A typical workflow using the Popup Player:
1. Open a camera in popup mode
- Use Open in popup from the Views list or tile action
2. Confirm Live Mode
- The player opens in LIVE mode by default
- Verify the live stream is visible
3. Switch to Playback
- Click Switch to Playback
- Select a time range and load recordings
4. Review the Incident
- Use the timeline and playback controls to locate the relevant segment
- Step frame-by-frame if needed
5. Return to Live
- Click Switch to Live
- Continue monitoring in real time
## Setup and Verification – Example
### Example: Open a Camera in Popup and Review an Incident
1. Open the Popup Player
- From a view, click Open in popup for a camera
2. Verify Source Loading
- Confirm the stream loads successfully in LIVE mode
- If “Missing source id” appears, verify the popup URL includes the stream query parameter
3. Switch to Playback
- Click Switch to Playback
- Choose a From/To range around the incident
- Click Load
4. Verify Timeline and Playback
- Confirm segments appear in the timeline
- Start playback and verify stepping/speed controls work
5. Return to Live
- Click Switch to Live
- Confirm the live stream resumes correctly
This confirms correct source passing, mode switching, and both live + playback operation inside the popup window.
## Note: Source Parameter Requirements
The Popup Player requires a valid stream identifier passed via the URL query string (for example: stream=`<id>`).
If the parameter is missing or invalid, the player will not load video and will display the “Missing source id” message to indicate misconfiguration.
<div class="page-break" style="page-break-before: always;"></div>