Customizing the Koi Player for Audio
This tutorial explains how to embed and customize the Koi Player for high-quality, accessible audio playback, including built-in waveform support β no third-party components needed.
Requirements
- Your audio content is published and you have:
- a valid audio
media-id - your organization ID (
orgId) - your Arc XP API token (
arc-token)
- a valid audio
- The environment for playback (
"prod"or"sandbox").
Recommended Usage
Use the koi-card-audio-player element as shown below, with all required authentication and configuration attributes.
<koi-card-audio-player media-id="YOUR_AUDIO_CLIP_ID" config='{"orgId":"YOUR_ORG_ID","env":"prod"}' arc-token="YOUR_API_TOKEN" show-waveform style="width:120px;height:120px;"/>media-idβ The unique ID for your audio clip.configβ JSON string (required). Must contain at least yourorgIdandenv(use"prod"for production).arc-tokenβ Your Arc XP API token.show-waveformβ Enables the native waveform display (recommended for best UX).styleβ Controls the widget size.
Customization and Theming
You can style the player with CSS variables:
koi-card-audio-player { --border-radius: 8px; --waveform-background-color: #18181b; --waveform-center-line-color: #313131; --waveform-played-color: #51e9c2;}Add more styles as needed to match your brand.
Full List of CSS Variables
You can customize the look and feel of Koi players and their waveforms using these CSS custom properties, set directly on <koi-card-audio-player>, <koi-player>, or a wrapper element.
koi-card-audio-player, koi-player { --border-radius: 10px; --waveform-background-color: #758ef0; --waveform-center-line-color: #313131; --waveform-played-color: #48bb78; --waveform-unplayed-color: #ccc; --waveform-bar-thickness: 0.7; --waveform-aspect-ratio: 4; --waveform-play-button-background: rgba(255,255,255,0.2); --media-icon-color: #fff; /* Loading and general UI */ --koi-loading-background: #bec2d9; --koi-loading-color: #16162a; --koi-loading-track-color: rgba(22,22,42,0.15); --koi-loading-indicator-color: #16162a;}Waveform-Related
--waveform-background-colorβ Waveform background fill.--waveform-center-line-colorβ Line color through waveform center.--waveform-played-colorβ Elapsed (played) portion.--waveform-unplayed-colorβ Remaining (unplayed) portion.--waveform-bar-thicknessβ Thickness of each waveform bar (e.g.,0.5).--waveform-aspect-ratioβ Waveform aspect ratio (e.g.,4).--waveform-play-button-backgroundβ Play button background when overlayed.
Card and Player General
--border-radiusβ Border radius for player UI containers.--media-icon-colorβ Icon color for player controls.
Loading State
--koi-loading-backgroundβ Loader background.--koi-loading-colorβ Loader foreground/text.--koi-loading-track-colorβ Spinner unfilled part.--koi-loading-indicator-colorβ Spinner active/filled part.
Further Customization with Media Chrome
Koi is built atop media-chrome, which exposes additional CSS variables for theming controls, sliders, time displays, and more. For an extensive list and usage examples, see Media Chrome β Styling with CSS Variables.
Additional Tips
- The player will display waveform data if available (and
show-waveformis set). - All other player features β scrubbing, play/pause, volume β are enabled by default.
- The
configattribute takes precedence and will override separate attributes likeorg-idandenv. - Analytics are enabled when you include correct
configandarc-tokenvalues.