Tech Note: Ajax and Timers and Tunes

Charles Johnsonfollow me on twitter
Fri Jul 25, 2008 at 3:52 pm PDT • Views: 162

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.

Advertisement

427 comments

^ back to top ^

Name:

Pass:

Register Forgot Your Password? Account Settings Re-send Confirmation (To log in, cookies must be enabled in your browser!)

Turn off ads by subscribing!
For about 33 cents a day, our subscription option turns off all advertisements at LGF!
Read more...


► LGF Headlines

  • Loading...

► Tweeted Articles

  • Loading...

► Tweeted Pages

  • Loading...

► Top 10 Comments

  • Loading...

► Bottom Comments

  • Loading...

► Recent Comments

  • Loading...

► Tools/Info

► LGF Hits

► Resources

► Never Forget

► Statistics

► Tag Cloud

► Contact

You must have Javascript enabled to use the contact form.
Your email:

Subject:

Message:


Messages may be published in our weblog, unless you request otherwise.
Tech Note:
Using the Contact Form

More Partners

Compare Electricity Prices in your area. Texas Electricity is deregulated; you have the right to choose Texas Electric Rates from among many Texas Electric Companies.

New world odor.

TwitterFacebook
LGF Pages
Recent Pages

Channeling Confucius
Syria 'Emboldened by UN Inaction'
1 hour, 13 minutes ago
Views: 40 • Comments: 0
Tweets: 0 • Rating: 0

Channeling Confucius
Coming out
1 hour, 23 minutes ago
Views: 57 • Comments: 0
Tweets: 0 • Rating: 0

Daniel Ballard
Animal-Made 'Art' Challenges Human Monopoly on Creativity
1 hour, 48 minutes ago
Views: 77 • Comments: 1
Tweets: 0 • Rating: 1

Daniel Ballard
Congress Left in Dark on DOJ Wiretaps
1 hour, 51 minutes ago
Views: 64 • Comments: 0
Tweets: 0 • Rating: 1

researchok
Obama Budget: National Debt Will Be $1 Trillion Higher in a Decade Than Previously Forecast
2 hours, 15 minutes ago
Views: 78 • Comments: 0
Tweets: 0 • Rating: 0

Interesting Times
24 Hours to Stop Keystone XL
2 hours, 59 minutes ago
Views: 139 • Comments: 0
Tweets: 8 • Rating: 0

researchok
California's Nuclear Alarm Bells
3 hours, 3 minutes ago
Views: 92 • Comments: 0
Tweets: 0 • Rating: 1

researchok
Room for Lobbyists in Romney Campaign
3 hours, 8 minutes ago
Views: 75 • Comments: 0
Tweets: 0 • Rating: 0

Channeling Confucius
The Parts of Obama's Budget That May Actually Get Passed - the Atlantic Wire
3 hours, 15 minutes ago
Views: 66 • Comments: 0
Tweets: 0 • Rating: 0

Bob Dillon
Molecules From Scratch Without the Fiendish Physics
3 hours, 20 minutes ago
Views: 74 • Comments: 0
Tweets: 0 • Rating: 1

 Frank says:

Ooooh the way you love me baby,
I get so hard now I could die.
Ooooh the way you squeeze me lady
red balloons just pop behind my eyes -- Magic Fingers, 200 Motels