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

There is no documentation for wasUser and no documentation for when a track naturally ends #28

Open
SaadArdati opened this issue Aug 13, 2020 · 5 comments

Comments

@SaadArdati
Copy link

SaadArdati commented Aug 13, 2020

For every wasUser parameter for the soundPlayer events, wasUser always always returns false.
It's unclear what it does. I tried triggering the events both from in the app and from the shade UI.

There's also no documentation for when a player naturally ends. Like a bolean for onStopped() that dictates if the player was stopped because the track ended or because something else stopped it. Or perhaps add a "complete" enum to the DispositionState enum class. "Stop" is too general and limits things like auto playing

@bsutton
Copy link
Owner

bsutton commented Aug 16, 2020

The wasUser flag is meant to indicate that a user caused the stop to occur.
If wasUser is false then the system naturally ended.

There is a bug in ShadePlayer that isn't setting wasUser

What if we changed the wasUser bool to an enum:

Completed - the audio completed to its end
User - the user stopped playback
Error - an error occurred causing playback to stop
System - ? if you call release the audio will be stopped. I guess this could be considered an 'App' stop. I cant' currently find any paths in the code that could result in the 'system' causing audio to stop (as apposed to the system pause/resume). So maybe we can ignore this one.
App - ? do we need this. If the api SoundPlayer.stop is called by the 'app' rather than as a user action. This is possible useful as it allows the app internally to differentiate when the callback occurs.

This enum could then also be reflected in the DispositionState as you suggested.

Thoughts?

@SaadArdati
Copy link
Author

imo an event is more suited, like onComplete that only triggers when the track ends naturally. You gotta rename wasUser to something more descriptive though, like "isCompleted" or something. The Boolean doesn't really make any sense in events like onStart, onResume, onPause because you said it's when the system stops, but those events are not for stopping

@bsutton
Copy link
Owner

bsutton commented Aug 16, 2020 via email

@SaadArdati
Copy link
Author

Imo that causes behavior that prevents granularity.
What are the separate events? I was under the assumption that calling any player function would cause it's respective event to fire, and under the assumption that the shade UI calls the same events for the same functions.
So player.pause() and clicking the pause button in the shade player would both trigger onPause event. Is this not how it works? I didn't see any other events.

@bsutton
Copy link
Owner

bsutton commented Aug 16, 2020 via email

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

No branches or pull requests

3 participants