views:

205

answers:

2

I'm looking for a media player (audio) that I can embed in my website (a rails app) to allow streaming audio which doesn't stop when the user goes to another page of my website. Ideally it would be modal.

I've tried using the YUI Media Player but the audio reloads when users move away from the homepage and most users don't think to play it in the a new tab (as the YUI Media Player allows) until it's too late.

I've been using Olark to add a chat facility to my site and it does allow users to browse the site whilst keeping the chat session alive.

Does such a modal audio plugin or widget exist? Or should I start coding it myself?

I know I can always just force the media player to open in a new tab, but I'd like to keep things on the same screen... I must admit, I've not seen such a tool out there so I'm not too confident of finding one. Any help would be appreciated.

Pardon me if I've got the tags wrong

+1  A: 

I've was involved in developing a website that did exactly this.

Short Answer: This isn't something a widget can do.

Long Answer:

The main problem is that when the user navigates to a new page, the old one is entirely thrown away - this includes the media player. There's no way around this - to keep the music playing, you have to entirely prevent static loads. We solved this problem by using AJAX to replace content on the site when a user tried to navigate, and as far as I know this is the only feasible approach. Basically we'd capture link clicks and do an AJAX load, swapping out the relevant HTML in the DOM with the HTML fetched from the server.

Speaking from experience, writing a site that operates in such a fashion is significantly more work. At first blush it may seem easy, but there are a lot of edge cases to consider (GET args suck), and there are a lot of parts to bring together to create a nice user experience (fragment-based URLs, back button support, the list goes on). Additionally, you still have to deal with static page loads, so you'll likely have to create a bit of a framework around your whole dynamic loading.

That being said, if you really really must have this feature, there are benefits. When all was said and done, the site I worked on actually had a better user experience than most others: page loading was faster, resources (CSS, images, etc) were automatically cached, AJAX pagination/form validation was essentially free, and we ended up doing some cool things with login/logout. But it was a lot of work to get to that point.

ShZ
thanks a lot - it's just as I thought - I can imaging how much work it will be, and since I don't have the time, I think I will just have a warning that the media stream is lost between pages and encourage people to think about opening it in another tab.... Thanks again.
stephenmurdoch
+1  A: 

You can do this, but you have to choose between the always-on music player and bookmarkability. In order for the music player to follow you from page to page, it has to be in a (hidden) frame that encapsulates the rest of the site UI so that the player is never interrupted, the only changes happen in a subframe, leaving it undisturbed. This means that the URL in the address bar stays the same as the user clicks to different parts of the site. If this is acceptible, you can use YUI player or XSPF or pretty much anything, since the only real problem is to prevent the player stream from getting broken.

Eric Hill
Good idea - AJAX is not necessary if frames are acceptable.
Pool