tags:

views:

177

answers:

4

Client is requesting a single track to be heard across the website. Generally I advise against it, but they insist. So, what is the most straightforward way of having a flash player embedded in a site, and when a user goes to another page there isn't a gap/interruption?

I am thinking an iframe is required.. I am using a flash player that has autoresume, but that only solves picking up where you last left off on the song before going to another page. I tried searching SO for an answer..

+1  A: 

To do something like that you'd need to keep the browser on the same page and load the contents of the page using AJAX. The html you get back from your AJAX requests could be placed in an iFrame but there's no advantage to doing so. Really you'll need to know a bit of Javascript and AJAX. If you haven't done much AJAX I'd start with JQuery as it makes it quite a bit easier.
Of course doing a whole website like this could become very complicated especially if the pages are doing anything more complicated than showing text. Also take into consideration that the address bar will always show the same address so bookmarking pages wouldn't work. Again you could probably find a way around this, but my point is there's a lot of little things you'll have to think about if you decide to go this route.

Peter
Yeah, I don't want to spend a ton of time on it since its on a budget, so I'd like to avoid iframes if I can. Or, if they can just accept that they can't really reliably get uninterrupted playback without affecting site management, SEO, JS compatibility with browsers, etc..
Kevin
Then you should probably tell them that doing this would limit the other features the site is capable of and may lead to unexpected results. Point out that most websites don't do this because it isn't easy.
Peter
A: 

Create a hidden iframe behind the current content. Play content there. Have page-to-page navigation happen in the top frame, so the background frame stays in place. As a minus, the URL will stay the same.

Seriously, though, the site's going to suck unless there's a way to turn the crap off.

Dean J
+4  A: 

If you want it totally uninterrupted, you'll have to embed the whole site in an iframe, or load pages via Ajax.

If you can tolerate a pause in the music, what you could do is modify your Flash music player to keep a cookie with the current position in the song and when it loads checks for the cookie and resumes playing at that place.

Both are kind of ugly hacks, but so is forcing the user to listen to music.

Jordan
Heh yeah I know. I really didn't want to do it and posed all the arguments why you shouldn't do it (user annoyance for one)- and the flash player has the autoresume functionality already in it. I just need to prepare myself if a half second 'pause' between page loads is not to their liking.
Kevin
+1  A: 

You can try a popunder. As horrid as that is, you can't really do much worse than playing music on a site anyway, so if the client would be ok with it, it's an option.

Bart van Heukelom