combine-video-frame-distribution

Broadcasts camera CVPixelBuffer frames to multiple subscribers via PassthroughSubject in Combine workflows.

Updated Dec 23, 2025
One-click install
npx skills add https://github.com/co-labs-co/context-harness-skills --skill combine-video-frame-distribution
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: combine-video-frame-distribution
Source: https://github.com/co-labs-co/context-harness-skills/tree/main/skill/combine-video-frame-distribution
Command: npx skills add https://github.com/co-labs-co/context-harness-skills --skill combine-video-frame-distribution

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Efficiently distribute live camera frames to multiple subscribers in a thread-safe, low-latency manner.

Core Features & Use Cases

  • Thread-safe frame publishing: Broadcast CVPixelBuffer frames to many receivers without duplicating work.
  • Real-time, low-latency delivery: Avoids polling and supports cross-thread delivery for UI and encoding.
  • SwiftUI integration-ready: Seamlessly feeds UI previews and processing pipelines.

Quick Start

Set up a CameraManager that publishes CVPixelBuffer frames using a PassthroughSubject and register UI and encoding subscribers to consume the frames.

Frequently Asked Questions about combine-video-frame-distribution

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I distribute real-time video frames to multiple subscribers in Swift?

You can distribute real-time video frames to multiple subscribers in Swift by using a Combine PassthroughSubject to broadcast CVPixelBuffer frames, ensuring thread-safe and low-latency delivery across UI and encoding pipelines.

What is the best way to handle thread safety when broadcasting CVPixelBuffer frames in iOS?

The best way to handle thread safety when broadcasting CVPixelBuffer frames in iOS is to use a thread-safe publisher like PassthroughSubject with proper threading via receive(on:) to safely deliver frames to multiple subscribers without duplicating work.

Can I use Combine to feed a SwiftUI preview and an encoding pipeline simultaneously?

Yes, you can use Combine to feed a SwiftUI preview and an encoding pipeline simultaneously by registering multiple subscribers to a single CVPixelBuffer stream, enabling real-time cross-thread delivery without backpressure buffering.

Why does my video streaming pipeline drop frames when adding multiple subscribers?

Your video streaming pipeline drops frames when adding multiple subscribers because it lacks a multi-subscriber delivery mechanism; using a Combine PassthroughSubject avoids backpressure buffering and ensures low-latency distribution.

Does this video frame distribution approach support backpressure handling?

No, this video frame distribution approach does not support backpressure buffering; it is designed for real-time, low-latency delivery of CVPixelBuffer frames to multiple subscribers without duplicating work.

How do I set up a CameraManager to publish video frames using Combine?

To set up a CameraManager to publish video frames using Combine, configure a PassthroughSubject to broadcast CVPixelBuffer frames and register your UI and encoding subscribers to consume the real-time stream safely.