Giter VIP home page Giter VIP logo

Comments (7)

sunny avatar sunny commented on August 19, 2024

Hi @irosenb!

How do you use this @playing variable on the page?

I have tried the same and this variable works when you reload the page. If you want to update the page when the song info updates you need to update this via JavaScript. Check out the lines just below which render the JSON response and check out how the page is updated in JavaScript:

// public/script.js:85
$('#title' ).text(title)

from so-nice.

sunny avatar sunny commented on August 19, 2024

Hey @irosenb, any luck with what you were trying?

from so-nice.

sunny avatar sunny commented on August 19, 2024

@irosenb, did you manage to make it work? Any code that could be added to so-nice?

from so-nice.

irosenb avatar irosenb commented on August 19, 2024

No I didn't. The problem was that I wanted to pause the music and have the icons change without latency. It seemed almost impossible. When it got pretty smooth, it would mess up if you paused and played very fast. I haven't worked on it in a while so I'm faintly recalling the problem.

from so-nice.

sunny avatar sunny commented on August 19, 2024

Interesting problem: because of the latency and network errors they can get out of sync.
A way to solve this would be to remove the fact that ajax events are asynchronous by queuing all the callbacks somehow, but that isn't trivial.

Another thing that could help would be to reduce the latency by removing one ajax request. Right now the buttons do two Ajax requests: one to PUT the action and another to GET the information. If the PUT returned the new information, it would feel 2x faster!

from so-nice.

sunny avatar sunny commented on August 19, 2024

Another way that comes to mind is to always send and use the current playing state, at every request. So if it does get out of sync it could fall back into place quite quickly.

from so-nice.

sunny avatar sunny commented on August 19, 2024

Closing this for now. Let me know if you're still fiddling with it and we can reopen.

from so-nice.

Related Issues (20)

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.