Git Product home page Git Product logo

accessify-prototype's People

Stargazers

 avatar

Watchers

 avatar  avatar

accessify-prototype's Issues

GUI becomes outdated when seeking between tracks

Currently, due to the use of HTTP long polling, we receive playback events from Spotify in near-realtime. This allows the GUI to be kept up-to-date when playing, pausing and skipping tracks. Unfortunately, when seeking forward results in a new track being played, the HTTP connection remains open and the GUI doesn't update accordingly.

This isn't a significant problem at the moment, partly because the use case of seeking through the playback queue is a pretty obscure one. However, in the future when we need to be absolutely sure when one song has ended and another one has begun, it will become necessary to find a fix for this.

Notes:

  • If the playback queue only contains one track, seeking past the end of it results in the HTTP connection being closed as expected.
  • Providing returnon values of "seek" and "position" in the call to /remote/status.json doesn't seem to help.
  • Using sleep-based, incremental polling of the remote status causes the Spotify Web Helper to use a lot of CPU, even when using an interval of 1 second. So this isn't a good way to solve this either.

Throttle the allowed number of playback commands per second

Currently, we allow an unlimited number of playback commands to be executed in succession. This probably isn't a good idea and so far, has flagged up the following problem:

  • Spotify seems to have an undocumented skip limit in place for all playback sources. If you skip forward faster than approximately 10 skips per second, skip functionality is temporarily disabled.

Implement an event queue for Spotify state changes

Currently, the workflow for dispatching Spotify state change events looks like this:

  1. Fetch initial status and update listeners.
  2. Open an HTTP long polling session which returns status info when something changes.
  3. In the same thread, process the status updates e.g. check whether the current track or playback state has changed and update the listeners accordingly.
  4. Loop back round to step 2.

With this workflow in place, a race condition makes it possible to toggle the playback state multiple times before the spotify.EventManager loop has continued round to create a new polling connection, meaning the playback state inside listeners becomes out of date until another playback command has been issued.

The proposed workflow would look like:

  1. Fetch initial status and post it to the event consumer queue.
  2. Open an HTTP long polling session which returns status info when something changes.
  3. When new status information arrives, post it to the consumer queue and loop back around to create a new long polling connection immediately.

Meanwhile, in the event consumer thread:

  1. Pull the latest status information from the queue.
  2. Process the status updates e.g. check whether the current track or playback state has changed and update the listeners accordingly.
  3. Loop back round to step 3.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.