Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Styling the player #70

Open
vbudilov opened this issue Dec 3, 2019 · 2 comments
Open

Styling the player #70

vbudilov opened this issue Dec 3, 2019 · 2 comments

Comments

@vbudilov
Copy link

vbudilov commented Dec 3, 2019

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
Copy link
Author

vbudilov commented Dec 6, 2019

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>

@lhz516
Copy link
Contributor

lhz516 commented Dec 18, 2019

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants