Player Documentation

website·Indexed 29 days ago

https://player-ui.github.io/latest

A framework for authoring and rendering content-driven experiences across React, iOS, and Android. It features a Domain Specific Language (DSL) for assets and views, an AST-based model for content representation, and a plugin system to extend functionality via hooks. Includes tools like the Player Language Service (LSP), a CLI for exporting XLR definitions, and a runtime architecture consisting of FlowController, SchemaController, and ExpressionEvaluator.

Tokens
59.9K
Snippets
301
Records
433
Agent score
75%

What's inside Player

  1. Overview of ErrorController

    The ErrorController manages error handling throughout the flow lifecycle. It is automatically instantiated by Player when a flow starts and is accessible via the error property in the controller state. It captures errors with metadata, maintains a chronological error history, and exposes error information to views through a protected errorState binding.
  2. Overview of SchemaController

    The SchemaController is the central hub for data invariants and metadata associated with the data model. It does not manage state itself but serves as an orchestrator that other modules use to interface with the schema. It is constructed once per player.start(flow) call using userFlow.schema and is a prerequisite for the DataController and ValidationController.
  3. Overview of ViewController and ViewInstance

    The ViewController is a long-lived manager (one instance per player.start() run) responsible for updating and switching views based on the flow's navigation state and the data model. It mints a ViewInstance, which is a short-lived, stateful object created for the currently active view and replaced whenever navigation lands on a new VIEW state.
  4. Overview of AsyncNode Plugin

    The AsyncNode Plugin enables streaming of additional content into a flow that has already been loaded and rendered. This is achieved through AsyncNodes—placeholder nodes in the AST (marked with async: true) that are replaced by concrete nodes in the future. To maintain a continuous stream of content, at least one AsyncNode must remain in the view tree at all times.
  5. Overview of Player Content Validation

    Player content can be validated using XLRs to ensure it is semantically valid before publishing. While this semantic check does not guarantee the content will run, it identifies common authoring issues. Validation is compatible with any Player integration that publishes XLRs.
  6. Overview of Player DSL for Content Authoring

    The Player DSL allows developers to author content as React components and TypeScript objects using (J/T)SX instead of writing directly in JSON. This approach provides better maintainability through more concise code, an improved development experience with IDE type-checking and suggestions, and easier extensibility by allowing common patterns to be extracted into higher-level components or generated programmatically. The Player CLI is used to transpile this React tree into the final JSON content.
  7. Overview of the View Parser and Resolver

    The View Parser and Resolver together act as the engine that transforms JSON view definitions into a data-bound render tree.

    1. The Parser: Converts an incoming JSON view into an Abstract Syntax Tree (AST). It allows for mutation of objects before and after the creation of AST nodes.
    2. The Resolver: Takes the parsed AST graph and resolves it into a concrete representation of the current user state. It handles mutating AST nodes before resolution and mutating the resulting resolved objects during the process.
  8. Overview of Player DSL Plugins

    DSL Plugins in Player are mechanisms used to alter how DSL Content is compiled into the JSON format that the Player ingests. A 'DSL Plugin' is not a specific code construct but rather any method used to manipulate the DSL or Schema, such as using CLI plugins or interacting with DSL hooks directly.
  9. Overview of A2UI Plugin functionality

    The A2UI plugin provides a content adapter that allows agents to drive Player UI using a flat, id-linked snapshot of components. The adapter transforms this snapshot into a normal Player Flow, meaning that schema, validation, data binding, navigation, and rendering all run through the standard Player pipeline.

    Supported components in the A2UI v0.9.1 reference catalog include: Row, Column, List, Text, Image, Icon, Divider, Button, TextField, CheckBox, Slider, DateTimeInput, ChoicePicker, Card, Modal, and Tabs.

  10. Overview of the Runtime Validation System

    The ValidationController orchestrates runtime validation within a running Player instance. It tracks validations per binding and gates both individual data set calls and whole-view navigation. This system is distinct from static content validators (XLR/LSP) as it operates against live user data during flow execution.
  11. Overview of the Player framework

    Player is a framework designed to natively render experiences across multiple platforms using a declarative content payload. It is used to accelerate development by offloading data and state management, allowing experiences to integrate with other applications with minimal configuration.
  12. Overview of Player Language Service (LSP)

    The PlayerLanguageService (referred to as "The LSP") is the core system for interacting with Player Content. It parses JSON into a manipulable Abstract Syntax Tree (AST) and ensures that content adheres to Player semantics and integration specifics. While users typically interact with the LSP through tools like the Player CLI, developers can extend its functionality by creating CLI plugins.