Tech Note: Ajax and Timers and Tunes

• Views: 1,572

The “Now Playing” section of our left sidebar, which is set up to show the music or other weird sounds that are currently playing in iTunes on my machine, now updates in an “almost live” fashion. With Ajax and a Javascript timer, it checks the server every 20 seconds to see if there’s been a song change, then does a fade-in effect with any new artwork and song info.

The Ajax code on the server sends back a very small JSON message if the song hasn’t changed since the last check, to keep server impact to a minimum. So far, on a Friday afternoon with traffic down a bit because everyone’s been bludgeoned into political comas by this endless week of Obamaton grandstanding, the web server doesn’t seem to be struggling at all.

On a related subject, I still get occasional email asking how to hear the music that shows up under “Now Playing.” Well, I can’t stream it here without paying absurd licensing fees through the usual suspects, of course. Anyone remember Napster? No? That’s why.

The album cover is a link to the record’s page at Amazon, though, and they usually supply some kind of preview. If the album’s available in their MP3 Store, you can listen to samples right there. So that’s better than nothing, if you’re really curious about why I’m listening to that horrible Rob Zombie album again.

Jump to top

Create a PageThis is the LGF Pages posting bookmarklet. To use it, drag this button to your browser's bookmark bar, and title it 'LGF Pages' (or whatever you like). Then browse to a site you want to post, select some text on the page to use for a quote, click the bookmarklet, and the Pages posting window will appear with the title, text, and any embedded video or audio files already filled in, ready to go.
Or... you can just click this button to open the Pages posting window right away.
Last updated: 2023-04-04 11:11 am PDT
LGF User's Guide RSS Feeds

Help support Little Green Footballs!

Subscribe now for ad-free access!Register and sign in to a free LGF account before subscribing, and your ad-free access will be automatically enabled.

Donate with
PayPal
Cash.app
Recent PagesClick to refresh
The Pandemic Cost 7 Million Lives, but Talks to Prevent a Repeat Stall In late 2021, as the world reeled from the arrival of the highly contagious omicron variant of the coronavirus, representatives of almost 200 countries met - some online, some in-person in Geneva - hoping to forestall a future worldwide ...
Cheechako
Yesterday
Views: 80 • Comments: 0 • Rating: 1
Texas County at Center of Border Fight Is Overwhelmed by Migrant Deaths EAGLE PASS, Tex. - The undertaker lighted a cigarette and held it between his latex-gloved fingers as he stood over the bloated body bag lying in the bed of his battered pickup truck. The woman had been fished out ...
Cheechako
2 weeks ago
Views: 253 • Comments: 0 • Rating: 1