Xcode 27 beta can reject composition-backed playback before a custom AVVideoCompositor receives requests

GitHub source

Reproduced. This page is generated from GitHub Issue #23; GitHub remains the canonical authoring and discussion source.

Source#

Apple Developer Forums — “Custom AVVideoCompositing on a composition-backed AVPlayerItem fails with AVErrorUnknown Xcode 27 beta 2 / beta 3”:
https://developer.apple.com/forums/thread/837179

Minimal public repro linked by the reporter:
https://github.com/BugorBN/avplayer-custom-compositor-repro

Apple documentation:

Problem#

A trivial pass-through AVVideoCompositing implementation used with a composition-backed AVPlayerItem works with Xcode 26 and earlier, but the same repro fails when built/tested with Xcode 27 beta 2/3. The player reports:

AVFoundationErrorDomain -11800 (AVErrorUnknown)
underlying error -12784

The strongest discriminator is not the numeric error. It is the toolchain/SDK boundary with otherwise equivalent composition/compositor logic.

The debugging target is therefore:

AVComposition
→ AVVideoComposition validation
→ custom compositor instantiation
→ render-context negotiation
→ startRequest(_:)
→ composed frame
→ AVPlayerItem readiness

Find the first stage reached on the Xcode 26 control but not on the Xcode 27 beta failure.

Evidence level#

DOCUMENTED#

Apple documents customVideoCompositorClass as the supported way to provide an AVVideoCompositing implementation. The class must implement AVVideoCompositing. Apple documents startRequest(_:) as the callback in which the custom compositor receives an AVAsynchronousVideoCompositionRequest and must finish it with either a composed frame or an error.

Apple's WWDC20 material demonstrates custom video composition as a supported AVFoundation editing/playback architecture.

OBSERVED#

The current Apple Developer Forums report says the minimal pass-through repro succeeds with Xcode 26 and lower but fails with Xcode 27 beta 2/3 with -11800, underlying -12784. A second developer reports the same issue.

IMPLEMENTATION EVIDENCE#

-12784 is an underlying implementation status in the failing path. No reviewed public Apple contract gives this number a stable semantic meaning, so it must not be used as the diagnosis.

The most valuable implementation evidence is whether AVFoundation:

constructs the compositor?
calls renderContextChanged(_:) ?
calls startRequest(_:) ?
provides source frames?

That locates the rejection relative to the app-owned compositor boundary.

INFERENCE#

If the failing build never instantiates the compositor or never reaches startRequest(_:), the defect is upstream of custom frame rendering: composition/video-composition validation, track/instruction resolution, pixel-buffer negotiation, or framework setup becomes primary.

If startRequest(_:) is reached and the same source frame is available as on the working build, the boundary moves into request completion/output validation.

UNKNOWN#

  • Exact semantic meaning of -12784.
  • Whether the regression is caused by the Xcode 27 SDK/link behavior, the iOS 27 runtime, or their combination.
  • Whether the failure requires AVComposition as the asset or also affects a direct file-backed AVPlayerItem with a custom video composition.
  • Whether pixel-format negotiation, instruction validity, track IDs, or another pre-render validation changed.
  • Fixed beta/OS build, if any.

Investigation / Explanation#

Do not begin by rewriting the compositor or guessing -12784.

Instrument lifecycle boundaries:

T0 AVComposition created
T1 source tracks inserted
T2 AVVideoComposition created
T3 instructions assigned
T4 customVideoCompositorClass assigned
T5 AVPlayerItem created
T6 videoComposition assigned to item
T7 compositor init
T8 renderContextChanged
T9 startRequest
T10 sourceFrame(byTrackID:) result
T11 finish(withComposedVideoFrame:)
T12 AVPlayerItem.status

For every run record:

Xcode version
SDK version
runtime OS build
source and composition track IDs
instruction requiredSourceTrackIDs
renderSize / frameDuration
sourcePixelBufferAttributes
requiredPixelBufferAttributesForRenderContext
compositor init/deinit
renderContextChanged callbacks
startRequest callbacks
source-frame availability
AVPlayerItem.status/error + full underlying chain

The key discriminator is the last callback reached before failure.

Also separate three version axes rather than saying only “Xcode 27 fails”:

build with Xcode 26 SDK → run on older runtime
build with Xcode 26 SDK → run on iOS 27 beta
build with Xcode 27 beta SDK → run on iOS 27 beta

Where deployment compatibility permits, this distinguishes link/SDK behavior from runtime behavior.

Verification matrix#

Use the same short local source asset and pass-through compositor:

A. direct AVAsset + ordinary AVPlayerItem, no video composition
B. AVComposition + ordinary AVPlayerItem, no video composition
C. AVComposition + built-in AVVideoComposition compositor
D. AVComposition + trivial custom AVVideoCompositor
E. direct asset + custom AVVideoCompositor where supported

Repeat across:

Xcode 26 / supported runtime control
Xcode 27 beta SDK / iOS 27 beta affected runtime
latest available Xcode 27 beta / iOS 27 beta

Then vary one compositor dimension at a time:

1. return an unchanged source pixel buffer
2. allocate output from renderContext.newPixelBuffer()
3. simplest 8-bit BGRA/YUV attributes
4. explicit source/output pixel formats
5. one video track / one instruction only

Interpretation:

B works, C works, D fails before compositor init
→ custom-compositor setup/validation boundary

D initializes but startRequest is never called
→ render-context/request scheduling boundary

startRequest is called but sourceFrame is nil only on failing build
→ track-ID/source-frame resolution boundary

source frame exists and finish(...) is called, then item fails
→ output-frame/completion validation boundary

C and D both fail
→ composition/video-composition path is broader than custom compositor

only D fails
→ custom AVVideoCompositing integration is isolated

Solution / Guideline#

  1. Keep a minimal Xcode 26 working build as the control; do not change media, composition topology, and compositor implementation simultaneously.
  2. Instrument compositor construction, renderContextChanged(_:), and startRequest(_:) before interpreting the final AVErrorUnknown.
  3. Reduce to one local video track and one pass-through instruction to remove network, DRM, HLS, and complex edit topology.
  4. Compare built-in and custom video composition using the exact same AVComposition.
  5. Explicitly log track IDs used by composition instructions and verify that sourceFrame(byTrackID:) can resolve the same IDs on working and failing builds.
  6. Use conservative, explicitly declared pixel-buffer formats as an A/B test; do not present format changes as a fix unless they move the first divergence.
  7. Treat -12784 as implementation evidence only until its producer condition is proven.
  8. For production, gate adoption of the affected SDK/runtime if this path is critical and no supported workaround has been verified; preserve the minimal repro for Feedback Assistant.

Reusable engineering rule#

For custom media pipelines, the last app-owned callback reached is a powerful fault boundary.

Instead of debugging from a terminal AVErrorUnknown, trace:

framework accepts configuration
→ custom component instantiated
→ render context negotiated
→ request delivered
→ source data resolved
→ app finishes request
→ framework accepts output

If a regression fails before your custom compositor receives a request, changing rendering code cannot fix the first failing transition.

References#