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

Correct behavior with multiple players #418

Merged
merged 3 commits into from
Mar 4, 2020

Conversation

cifkao
Copy link
Contributor

@cifkao cifkao commented Feb 27, 2020

This PR adds checks to BasePlayer to make sure only one player is active at a given time. An error is thrown if an action would put the player in an inconsistent state. Fixes #403.

music/src/core/player.ts Outdated Show resolved Hide resolved
music/src/core/player.ts Show resolved Hide resolved
music/src/core/player.ts Show resolved Hide resolved
*/
seekTo(seconds: number) {
if (!this.isPlaying()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this one either. You can definitely seek while the player is paused or stopped. I would remove this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above: isPlaying() returns true when the player is paused. And when it's stopped, you can't resume() it anymore; you can only call start() which will start playing from time 0. Am I correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In any case, we don't want to allow doing anything with the Transport when the player is stopped, because it might affect some other player.

@cifkao cifkao requested a review from notwaldorf March 3, 2020 13:11
Copy link
Collaborator

@notwaldorf notwaldorf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes!

@notwaldorf
Copy link
Collaborator

(I'll do a release now that has all of your recent changes, thanks so much for them!)

@notwaldorf notwaldorf merged commit 5ec7785 into magenta:master Mar 4, 2020
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

Successfully merging this pull request may close these issues.

Multiple players getting mixed up
2 participants