Skip to content

Machine-readable companion to .error(String) so a host can classify a failure #376

Closed

Description

@superuser404notfound

PlaybackState.error carries a human sentence and nothing else. On the native paths that sentence is AVPlayerItem.error.localizedDescription, forwarded verbatim, so it is localized into the device language and the NSError domain and code behind it are gone by the time a host sees it. The engine-authored messages are English-stable, but both halves arrive through the same publisher, so nothing distinguishes them except the text.

A host that buckets its failures (analytics, a fallback to a second engine) therefore has to substring-match a localized string, which puts every non-English device into "other". Raised on #374 by a downstream host building exactly that classifier, whose telemetry contract additionally forbids raw player error strings leaving the device.

Add an additive, machine-readable companion published alongside the state:

  • a stable engine-authored kind (PlaybackErrorKind, string-backed so a host can ship it as a token, and open so a new kind cannot break an exhaustive switch),
  • the underlying NSError domain and code where a Foundation / AVFoundation failure is involved,
  • the same message the state carries.

Assigned before state, so a $state sink can read it synchronously, and cleared by the state's own transition away from .error so the two cannot drift.

A numeric code is origin-free by construction, which also gives a host that cannot ship the string something it can ship.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions