SD Card Playback
Playback streams footage stored on the camera’s own SD card, rather than clips uploaded to the cloud. It uses the same WebRTC stack as live view — the difference is the object type:
let playback = LiveViewObjectStore.objectFor(
.cvrPlayback, spaceId: spaceId, deviceId: deviceId, wakeup: device.isMcuSupported
)
Live view and playback are cached separately, but a camera streams only one at a time: connecting playback terminates the camera’s live view session, and vice versa.
In this section
| Page | Covers |
|---|---|
| Setting Up | Creating the playback model |
| Rendering Playback | Attaching the video view and connecting |
| Playback Controls | Play, pause, seek and switching sensor |
| Event Handling | Locating recorded segments on the timeline |
Building a scrubber
mediaInfo(startTime:endTime:) asks the camera which segments exist in a range — that is what populates a timeline’s “has footage” bands. mediaInfoStartTime() asks for the earliest footage still on the card, which is where the timeline should begin.
The camera reports its position as a PlaybackMessage with action == .tsTimeStamp on onDataChannelMessage; timeStamp is the current position in epoch seconds. playbackCurrentTime only reflects the last seek target. End of footage arrives as a PlaybackMessage with action == .playbackEnd or .noMorePlaybackData — set sdCardPlaybackEnd = true yourself when you receive it so the SDK stops trying to reconnect; seekToTime clears it.