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

Play/Pause from custom Button doesn't sync with the player button #79

Closed
NISHANT061 opened this issue Jan 20, 2020 · 3 comments
Closed

Comments

@NISHANT061
Copy link

Trying to control play and pause with custom buttons doesn't work .Issue is the audio gets paused/played if i do this.audio.pause()/this.audio.play() . But the play/pause button doesn't sync with audio play/pause.

this.state = {
audio:null,
options: {
audioLists: [
{
singer: "Jay Chou",
cover: this.props.thumbnail,
musicSrc: this.props.streamUrl,
},
],
autoPlay: true,
mode: "full",
clearPriorAudioLists: true,
},
defaultPosition: {
bottom: 0,
},
};
togglePlay =()=>{
this.state.audio.pause()
}
<ReactJkMusicPlayer {...options} getAuioInstance={(instance=>this.setState({audio:instance})}/>
<button onClick={()=>this.togglePlay}>play

@lijinke666
Copy link
Owner

The player does not support this feature. I would consider adding the feature for custom button.
In fact, if custom button is fully supported, it can cause more problems.

@lijinke666
Copy link
Owner

The reason for adding getAuioInstance this is because like change playbackRate attr, nothing to do with the player native ui, so I support pause and play from custom button later

@lijinke666
Copy link
Owner

fixed. please use 4.7.2, thank your feedback.

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