mopidy / mopidy

Mopidy is an extensible music server written in Python
https://mopidy.com
Apache License 2.0
8.03k stars 686 forks source link

Stop tracking playback state manually #234

Open adamcik opened 11 years ago

adamcik commented 11 years ago

Currently we track the current playback state using our own state variable in the core playback code. This approach is rather cumbersome, and we should probably switch to just getting the state from Gstreamer.

jodal commented 11 years ago

This should fix #232 as well. I think this is rather easy to fix, given that we emit state change events up to the core layer.

adamcik commented 11 years ago

But you probably also want Gstreamer time tracking in the spotify backend for that, and at this point I'm thinking that might be more of an 0.10 thing as 0.9 has already been pushed back enough, and has enough large new stuff as is.

jodal commented 11 years ago

If we just added the playback state change events from audio to core in 0.9, and made core pause when audio pauses, that would fix #232, and would complement the switch to letting GStreamer track the state from 0.10 on.

jodal commented 11 years ago

Looking at other open bugs, I believe this would improve the situation for #202 as well.

jodal commented 11 years ago

Ok, this is my suggestion for way ahead after our discussion on IRC today:

For v0.9:

  1. Add a new event AudioListener.playback_state_changed(old_state, new_state)
  2. Add a state change message callback in audio which translates from GStreamer states to Mopidy states and triggers said event. It should only trigger on state changes to the playbin itself.
  3. Listen for said even in core.
  4. If new_state is PAUSED, check if core.playback.state is PAUSED, if not, set it to PAUSED. This should fix pausing when we lose the Spotify play token (#232).

For v0.10 or later:

adamcik commented 9 years ago

IMO this should probably happen in whatever release gapless lands in. As doing this should greatly simplify tracking states correctly in that case.

jodal commented 9 years ago

Then we change the milestone to the one with gapless in the title :-)