/* * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ import { AudioProps } from "./types.js"; import "client-only"; import * as react_jsx_runtime1 from "react/jsx-runtime"; //#region src/components/audio/index.d.ts /** * A complete audio player component. * * Combines an HTML audio element with MediaControls to provide a fully-featured * audio player with play/pause, seek, volume control, and playback rate adjustment. * * Uses media-chrome under the hood for state management and MediaController * for the accessible media chrome elements. * * @param props - The component props. * @param props.src - Audio source URL. Must be accessible to the browser - if loading * from a different origin, ensure the server sends appropriate CORS headers * (Access-Control-Allow-Origin) or use the crossOrigin prop. * @param props.title - Title to display (e.g., filename). * @param props.classNames - Class names for sub-elements. * @param props.isDisabled - Disable all audio controls. * @param props.crossOrigin - CORS setting ('anonymous' | 'use-credentials'). Required when * loading audio from a different origin that requires credentials or when using canvas * to analyze audio. Without proper CORS configuration, the audio may fail to load. * @param props.playbackRates - Array of playback speed multipliers (default: [1, 2, 3]). * Only positive finite numbers are accepted; invalid values are filtered out. * @param props.children - Custom controls to render instead of the default layout. * @param props.onEnded - Callback invoked when audio playback finishes. * @param props.onTimeUpdate - Callback invoked during playback with current time in seconds. * @param props.onError - Callback invoked when audio fails to load or encounters an error. * @param props.noHotkeys - Disable all keyboard shortcuts for media control. * @param props.hotkeys - Custom keyboard shortcuts configuration for media control. * @param props.noVolumePref - Disable automatic saving/restoring of volume preference. * @param props.noMutedPref - Disable automatic saving/restoring of muted state preference. * @param props.lang - Language code for localized media control labels. * @returns The rendered audio player component. * * @example * ```tsx * // Basic usage *