STEM Player / V2
← Back to Player
Reference / Live property playground · v0.20.13

Components & API

Real, reusable Web Components from STEM Player V2. Change each component’s display modes and properties, see the actual rendered result, and copy the JavaScript for the current configuration. No ALAC decoding or live audio is started on this page.

API MarkdownStandalone example
0 / 12registered elements
Shadow DOMscoped UI and styles
CustomEventcomposed event contracts

Quick start

Import one component or the complete registry, then set JavaScript properties with plain data snapshots. Subscribe to its outward-facing events and update the snapshot in your own application state.

import './components/index.js'; // registers all 12
const el = document.querySelector('stem-transport');
el.playback = { trackId:'demo', position:20, duration:180,
  playing:false, shuffle:false, repeat:false };
el.addEventListener('player-action', ({ detail }) => {
  // Respond to { action:'play' | 'seek' | 'skip' | ...,
  //               seconds?: number } and set a new snapshot.
});

Hosting: Serve the entire directory over HTTP(S) (e.g., localhost), not file://. Preserve components/ and shared/ together. Components do not depend on the ALAC engine, but the player application does.

Live interaction log

Try a component or change its property controls. Related previews share demonstration state, so changing a property can update more than one component. Events emitted across Shadow DOM appear here. The page handles the events with demonstration-only state.

No events yet.

Component catalog

12 components

Composition and state ownership

Components own presentation and gesture state. They do not own the song, audio playback, mute/solo truth, or persistent mix state. Your host application listens to events, modifies its own state, and sends refreshed snapshots through setters.

<stem-app id="app" data-screen="library" data-mode="player">
  <stem-library id="library-screen"></stem-library>
  <stem-player id="player-screen" mode="player">
    <stem-mixer slot="mixer" id="mixer-main"></stem-mixer>
  </stem-player>
</stem-app>

Optional app modules: state/stem-app-controller.js implements shared navigation, playback and mix snapshots; ui/stem-player-view.js binds events and view updates; services/core-playback-adapter.js is the separate ALAC Core integration. You can omit all three when using components in another app.

Attributes vs properties: The documented setters (e.g. .mix, .track) expect JavaScript objects, not JSON strings in HTML attributes. Each component below also has live controls for its supported presentation states and an automatically updated configuration snippet. The documented mode state also reflects to attributes in some elements for styling. The public component CSS lives inside each open Shadow Root. Parent layout still controls a component’s overall width and height.

Player view height: A standalone <stem-player> needs an explicit height (or a height-constrained parent). Its artwork and slotted mixer fill the flexible center. In mixer mode, the <stem-mixer slot="mixer"> child must also receive its own .track and .mix; setting player.stems only updates the toolbar count.

Event propagation: All listed events use { bubbles:true, composed:true }, so listeners can attach directly to the custom element or a higher-level host. A stem-mixer consumes child stem-action events and re-emits mixer-action.