<!--
{
  "availability" : [
    "iOS: 10.0.0 - 27.0.0",
    "iPadOS: 10.0.0 - 27.0.0",
    "macCatalyst: 13.1.0 - 27.0.0",
    "macOS: 11.0.0 - 27.0.0",
    "tvOS: 10.0.0 - 27.0.0",
    "visionOS: 1.0.0 - 27.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "ReplayKit",
  "identifier" : "/documentation/ReplayKit/RPBroadcastSampleHandler",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "ReplayKit"
    ],
    "preciseIdentifier" : "c:objc(cs)RPBroadcastSampleHandler"
  },
  "title" : "RPBroadcastSampleHandler"
}
-->

# RPBroadcastSampleHandler

An object that processes buffer objects as received from ReplayKit.

```
class RPBroadcastSampleHandler
```

## Overview

To handle <doc://com.apple.documentation/documentation/CoreMedia/CMSampleBuffer> objects as captured by ReplayKit, you subclass `RPBroadcastSampleHandler`. You enable this mode of handling by setting `RPBroadcastProcessMode` in the extension’s `Info.plist` file to `RPBroadcastProcessModeSampleBuffer`.

In your subclass, implement the [`processSampleBuffer(_:with:)`](/documentation/ReplayKit/RPBroadcastSampleHandler/processSampleBuffer(_:with:)) method to handle video and audio buffers, as well as the [`broadcastStarted(withSetupInfo:)`](/documentation/ReplayKit/RPBroadcastSampleHandler/broadcastStarted(withSetupInfo:)), [`broadcastFinished()`](/documentation/ReplayKit/RPBroadcastSampleHandler/broadcastFinished()), [`broadcastPaused()`](/documentation/ReplayKit/RPBroadcastSampleHandler/broadcastPaused()), and [`broadcastResumed()`](/documentation/ReplayKit/RPBroadcastSampleHandler/broadcastResumed()) methods to handle starting and stopping the broadcast.

ReplayKit invokes methods in your `RPBroadcastSampleHandler` subclass in a serial fashion. After invoking one method, ReplayKit won’t invoke another method until the first method returns. That means it’s safe for your implementations to update their stored state without the use of locks or synchronization to provide thread safety.

## Topics

### Handling Sample Buffer Clips

[`broadcastStarted(withSetupInfo:)`](/documentation/ReplayKit/RPBroadcastSampleHandler/broadcastStarted(withSetupInfo:))

Perform any required actions after starting a live broadcast.

[`broadcastPaused()`](/documentation/ReplayKit/RPBroadcastSampleHandler/broadcastPaused())

Perform any required actions after a live broadcast is paused.

[`broadcastResumed()`](/documentation/ReplayKit/RPBroadcastSampleHandler/broadcastResumed())

Perform any required actions after a live broadcast is resumed.

[`broadcastFinished()`](/documentation/ReplayKit/RPBroadcastSampleHandler/broadcastFinished())

Perform any required actions after a live broadcast is finished.

[`broadcastAnnotated(withApplicationInfo:)`](/documentation/ReplayKit/RPBroadcastSampleHandler/broadcastAnnotated(withApplicationInfo:))

Perform any required actions after starting a live broadcast.

[`RPApplicationInfoBundleIdentifierKey`](/documentation/ReplayKit/RPApplicationInfoBundleIdentifierKey)

The key to retrieve the app’s bundle identifier from the user-information dictionary.

[`processSampleBuffer(_:with:)`](/documentation/ReplayKit/RPBroadcastSampleHandler/processSampleBuffer(_:with:))

Processes video and audio data as it becomes available during a live broadcast.

[`RPVideoSampleOrientationKey`](/documentation/ReplayKit/RPVideoSampleOrientationKey)

The sample attachment key that describes the video orientation.

[`finishBroadcastWithError(_:)`](/documentation/ReplayKit/RPBroadcastSampleHandler/finishBroadcastWithError(_:))

Stops the broadcast and passes an error back to the broadcasting app.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)