UNPKG

@wix/design-system

Version:

@wix/design-system

75 lines (70 loc) 2.51 kB
import * as React from 'react'; export interface AudioPlayerProps { /** Applies a data-hook HTML attribute that can be used in the tests. */ dataHook?: string; /** Specifies a CSS class name to be appended to the component’s root element. * @internal */ className?: string; /** * Specifies a link to the source of the track to be loaded for the sound (URL or base64 data URI). * If a file has no extension, you will need to specify the extension using the format property. */ src: string; /** * Specifies a file format in situations where extraction does not work (such as a SoundCloud stream).<br/> * By default, AudioPlayer detects your file format from the extension. */ format?: string; /** * Determines what to download when the component is rendered: full file, its metadata or nothing at all. * When webAudioAPI = true you can only set it to either 'auto' or 'none'. * When webAudioAPI = false you can set it to 'auto', 'metadata' or 'none'. */ preload?: 'metadata' | 'auto' | 'none'; /** * Start playback automatically when audio is loaded. */ autoplay?: boolean; /** * Specifies whether to force web audio API. Use it for relatively small audio files only because you have to wait for the full file * to be downloaded and decoded before playing. Web Audio API allows advanced capabilities as described in * [Web Audio API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API). */ webAudioAPI?: boolean; /** * Defines a callback function which is called when audio is loaded. */ onLoad?(): void; /** * Defines a callback function which is called every time audio fails to load. */ onLoadError?(errorMsg: string): void; /** * Volume level from 0 (muted) to 1 (full volume). When not provided, defaults to Howler's default (1). */ volume?: number; /** * Defines a callback function which is called when audio is played. */ onPlay?(): void; /** * Defines a callback function which is called when audio is paused. */ onPause?(): void; /** Will be called when audio is ended. */ onEnd?(): void; /** * Defines a callback function which is called when audio is sought explicitly (i.e. when user drags the slider). */ onSeek?(): void; } export type AudioPlayerImperativeActions = { focus(): void; }; declare const AudioPlayer: React.FC< AudioPlayerProps & React.RefAttributes<AudioPlayerImperativeActions> >; export default AudioPlayer;