2

I'm setting up a radio/stream player on a website. The player could be an iframe with/or an object (type="application/x-shockwave-flash") or an <audio> element, inside the document in a sidebar, repeated all along the website. When the stream is playing and you browse thru any link to another site of the website the stream is obviously interrupted because of the loading of the site.

I want the player to keep playing even if I browse to another part of the site thru a link (ex. click on HOME) just like SoundCloud and Hypem do. I know these site are doing it by refreshing the rest of the site with ajax and leaving the player untouched.

My question is, is there another way to make this iframe/object/audio element to keep playing?

1 Answer 1

1

Once you have switched to the next page, everything on the original page is destroyed and stops running. There is no direct way around this fact. As you have said, the other sites work by not actually switching pages.

A common way to keep the audio going is to use a popup window for your player. This way, the audio player page is still around. You can even communicate with it from the other pages. (Check out JunoDownload.com for an example.) This is not typically a good method, as many popup blockers simply block all popups. Most popup blockers only block popups initiated outside of a user action though, so if you had a "play" button that launched the popup window, most users would still get it. Another reason this is a bad idea though is because it is a bit of a jarring user experience.

Another way is to simply set your link targets to _blank, opening them in a new tab or window. Just be careful to only do this from links from your player page.

Finally, some sites will continually post playback status to the server. On the next page, if a song was playing on the previous page, a new player will be started at the point in which the last page stopped. This is a bit annoying though, as the music stops for a period of time while that player loads.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.