Live data from Hacker News

Show HN: Beatbar - Media player that beats in the browser address bar

jaipandya.github.com

31–40 of 44 posts

Re: Show HN: Beatbar - Media player that beats in the browser address bar

#32

This is using the Ajax-era hash hack to change URL, which is causing problems with history and makes the reload button and favicon flash. I'd suggest using HTML5 history, specifically replaceState(). It works on all modern browsers. Works on IE10, but not IE9 and below. If you want to support IE, you could fall back to the current location.replace().

I started with replaceState only, but later I realized there was no specific gain that I was having (other than slightly good looking string without hash). This method also suffers from reload and favicon flashes. If it reliably doesn't log to history (unlike location.replace()), using it could be a good idea. But that also comes with a tradeoff of older browser support issues, which requires using external javascript APIs.

Re: Show HN: Beatbar - Media player that beats in the browser address bar

#33
post #7

If this doesn't work for anyone else, note that beatbar relies on soundcloud, and thus flash. I had flash blocked so was getting a javacript error because beatbar was undefined, enabled flash and it worked.

It uses soundManager for cross browser audio handling. It first tries with flash and fallbacks to html5 if flash is not available. Firefox with flash disabled wouldn't support mp3, and thus won't be able to play it. I am using SoundCloud api only to fetch streams.

HTML5 fallback seems to work fine on Safari iPad

Re: Show HN: Beatbar - Media player that beats in the browser address bar

#34
post #32

This is using the Ajax-era hash hack to change URL, which is causing problems with history and makes the reload button and favicon flash. I'd suggest using HTML5 history, specifically replaceState(). It works on all modern browsers. Works on IE10, but not IE9 and below. If you want to support IE, you could fall back to the current location.replace().

I started with replaceState only, but later I realized there was no specific gain that I was having (other than slightly good looking string without hash). This method also suffers from reload and favicon flashes. If it reliably doesn't log to history (unlike location.replace()), using it could be a good idea. But that also comes with a tradeoff of older browser support issues, which requires using external javascrip…

I see. Surprised to learn there were still issues as replaceState() (as with pushState) is purely a transformation in the URL path. There's no reload and no update of the favicon link tag. Makes me wonder if that's a browser bug you saw.

Re: Show HN: Beatbar - Media player that beats in the browser address bar

#37
post #10

Earlier quoted context omitted.

Hmm, that's odd, I'm using Chrome 19.01 and have no other plugins running asides FlashBlock. Once I disabled flash block everything ran fine. Does this version of Chrome not support the HTML5 fallback? Here's the Js error: Uncaught TypeError: Cannot call method 'init' of undefined /beatbar/:75 (anonymous function) /beatbar/:75 f.event.dispatch jquery.min.js:3 f.event.add.h.handle.i

I think soundManager requires some special handling for flashblock cases. I didn't test with flashblock on. Thanks for reporting the issue.

http://www.schillmania.com/projects/soundmanager2/demo/flash...

Re: Show HN: Beatbar - Media player that beats in the browser address bar

#38
post #32

This is using the Ajax-era hash hack to change URL, which is causing problems with history and makes the reload button and favicon flash. I'd suggest using HTML5 history, specifically replaceState(). It works on all modern browsers. Works on IE10, but not IE9 and below. If you want to support IE, you could fall back to the current location.replace().

I started with replaceState only, but later I realized there was no specific gain that I was having (other than slightly good looking string without hash). This method also suffers from reload and favicon flashes. If it reliably doesn't log to history (unlike location.replace()), using it could be a good idea. But that also comes with a tradeoff of older browser support issues, which requires using external javascrip…

What about detecting replaceState support and falling back to location.replace if necessary?
Post reply on HN