react-audio-player icon indicating copy to clipboard operation
react-audio-player copied to clipboard

Styling the player

Open vbudilov opened this issue 4 years ago • 2 comments

Can't seem to style the player. Is there a way to get to the actual 'audio' tag? Doing something like the following doesn't work (except for the width):

                            <ReactAudioPlayer
                                src={this.state.url}
                                autoPlay
                                controls={true}
                                volume={1.0}
                                style={{width: '100%', backgroundColor: "#fff", color: '#fff'}}
                                ref={(element) => {
                                    this.rap = element;
                                    this.rap.audioEl.backgroundColor = "#fff"
                                }}
                            />

vbudilov avatar Dec 03 '19 19:12 vbudilov

Per this stackoverflow question, you have to hide the browser-based implementation and just control the playback using JS.

Is there a way of achieving this with this reactjs library?

<audio id="player" src="vincent.mp3"></audio>
<div> 
  <button onclick="document.getElementById('player').play()">Play</button> 
  <button onclick="document.getElementById('player').pause()">Pause</button> 
  <button onclick="document.getElementById('player').volume += 0.1">Vol +</button> 
  <button onclick="document.getElementById('player').volume -= 0.1">Vol -</button> 
</div>

vbudilov avatar Dec 06 '19 15:12 vbudilov

If you are looking for React audio player with UI, you can try this one react-h5-audio-player which is also based on audio tag. Feel free to give me some feedbacks!

lhz516 avatar Dec 18 '19 08:12 lhz516