> For the complete documentation index, see [llms.txt](https://2600hz.gitbook.io/sds/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://2600hz.gitbook.io/sds/sds-components/simple-components/audio-player/code.md).

# Code

## Props

<table><thead><tr><th width="163.7588075896112">Props</th><th width="414.7376821119017">Data Type</th><th>Required</th></tr></thead><tbody><tr><td>className</td><td>string</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>src</td><td><ul><li>string (url to audio file)</li><li>mp3 file imported as a component</li></ul></td><td><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td></tr><tr><td>customData</td><td>Any</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>onInteraction</td><td>Function Event</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr></tbody></table>

### Event Response

| Property   | Data Type |
| ---------- | --------- |
| customData | any       |

### Example

```tsx
import React, {useState} from 'react';
import {AudioPlayer} from '@2600hz/sds-react-components';

const AudioPlayer = ()=>{

    const [newAudio, setNewAudio] = useState(true);
    
    const updateAudioHistory = ()=>{
        if(newAudio){
            setNewAudio(false);
        }
    }
    
    const interactionEvent(e){
        console.log(e.customData);
    }

    return(
        <div className='container'>
            <AudioPlayer
                className="AudioPlayerExample"
                customData='Example'
                onInteraction={interactionEvent}
                src="https://res.cloudinary.com/dcldwtvku/video/upload/v1646757629/Sipster/waves_eq05zf.mp3"
              />
        </div>
    );
}
```

## Components Dependency

For this component elaboration, the following internal components were used:

* [Slider](/sds/sds-components/form-controls/slider.md)
* [Button](/sds/sds-components/simple-components/button.md)

## Live Demo <a href="#live-demo" id="live-demo"></a>

For detailed code usage documentation, see the Storybooks for each framework below.​

### React <a href="#react" id="react"></a>

{% embed url="<https://sipster-react-component-storybook.netlify.app/?path=%2Fstory%2Fgeneral-components-audio-player--audio-player>" %}
