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

How to play next and previous song by API? #117

Closed
Jedliu opened this issue Jun 2, 2020 · 9 comments
Closed

How to play next and previous song by API? #117

Jedliu opened this issue Jun 2, 2020 · 9 comments

Comments

@Jedliu
Copy link

Jedliu commented Jun 2, 2020

How to play next and previous song by API?

Thanks for making such a great player!

Currently, we could call Play/Pause/Reload/Change Current Play Time and etc on Custom UI. Would it be possible to call PlayNext, PlayPrevious, and ChangePlayMode (loop, repeat, shuffle) as well? I tried to do it by updating the playIndex. However, it works not correctly.

Thank you,

@lijinke666
Copy link
Owner

I tried to do it by updating the playIndex. However, it works not correctly.

please provide a online url , what's your download player version?

@lijinke666
Copy link
Owner

Edit cold-shadow-w7lzs

@Jedliu
Copy link
Author

Jedliu commented Jun 4, 2020

Thank you. This is very helpful!

How about the change playMode? I tried to update the parameter of 'defaultPlayMode' but it doesn't work.

@lijinke666
Copy link
Owner

lijinke666 commented Jun 4, 2020

not currently supported change playMode by custom ui, welcome pr

@Jedliu
Copy link
Author

Jedliu commented Jun 5, 2020

Thank you for your reply. I will look into this again.

@lijinke666
Copy link
Owner

lijinke666 commented Jun 5, 2020

4.14.2 support change playMode now.

<ReactJkMusicPlayer playMode={...} />

@Jedliu
Copy link
Author

Jedliu commented Jun 7, 2020

Wow, that's great! Thank you!

@Jedliu
Copy link
Author

Jedliu commented Jun 10, 2020

Finally, I found the problem. Please check this Codesandbox

As soon as you add the onAudioProgress handler and access the duration and currentTime properties. You will not be able to play the next or previous song but the current song is repeated again and again. No matter you press the next or previous button or click another song in the playlist, it remains the same.

Kindly check it. Thank you,

@lijinke666
Copy link
Owner

Ok. please open a new issue. thanks

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