views:

1813

answers:

7

I was making a website for a music band, and i was wondering the best way to play background music on the website without interrupting the flow of the music (even for a split second).

At the moment, i am considering using frames, but this is not supposed to be good practice. Please someone tell me how i can do this. I would prefer to use HTML to code the website as i have not yet mastered coding in flash.

A: 

You would most likely need flash or a new window (pop-up) outside of the window.

Don't use frames. Ever.

EDIT: To all the people downmodding and commenting on this, not a single person has given a valid reason why you SHOULD use frames.

Just to clarify my position, please read ANY article on usability, the web, and frames.

For those still learning (and to those old people to dumb to update)

Frames break the unified model of the web.

Frames cause problems for search engine robots.

Frames make URLs stop working.

Frames break bookmarking.

Frames make printing more difficult.

Frames hurt accessibility.

Frames increase technical complexity.

and the #1 reason to not use frames......

USERS HATE THEM!

http://www.456bereastreet.com/archive/200411/who_framed_the_web_frames_and_usability/

Are there seriously this many people out there suggesting frames are a valid solution in 2009? How disappointing.

Syntax
As a user, I'd rather see frames than a pure-Flash website any day.
MusiGenesis
@MusiGenesis, +1
Dalin Seivewright
I agree with MusiGenesis here. It's also a simpler solution, and there's no anti-frame police that will hunt you down if you use frames.
Alex Fort
-1 simply because you said "Don't Use Frames. Ever.". While I don't think frames in general are the best thing, you really have to look at your own individual situation and see what works best for you. Same goes for many other controversial tools like the "GoTo".
Kibbee
I've left all of you some feedback and if I could -1 your comments I would. To anyone reading this, do not take these peoples advice if you intend on holding any type of professional job.
Syntax
@Syntax: Really? So if I use frames, the web police are going to come and shoot me? It'll immediately make me unemployable? This is news to me. Here's a good reason to use a frame: It's easy, and supported by all browsers. For a simple music player, it's the easiest solution.
Alex Fort
For a simple music player this requires no frames and no programming skills:http://www.longtailvideo.com/players/jw-flv-player/If you use frames you do not know what you are doing - REALLY.
Syntax
Oh sorry Alex Fort, I know the usability experts and the hundreds of books and research published on this subject can be thrown out the window. If you could rig your car to work with duct tape would you do it? I'm guessing you would. Its this type of mentality that produces sloppy work and code.
Syntax
A lot of high profile web shops use frames for well intended purposes. "Google Image Search" for one. A lot more use iframes. When there is a specific need for a technique, the professional uses it. There is no hard and fast "don't use X, ever" --this is taboo thinking, not programming and cost/benefit analysis.
foljs
+1  A: 

The only way to prevent the music from stopping is to not let the page your music component is on reload. Currently the only way to do this is to use frames, unfortunately.

The only alternative is to develop the whole site in Flash or another technology that doesn't rely on changing pages as navigation.

routeNpingme
+19  A: 

This might sound controversial, but here's an idea: Don't play music on your website. Seriously, don't. I think everyone knows how incredibly annoying that is, and asking a group of software developers to help you out with that is going to be like asking a group of sheep the best way to make a lambskin coat.

If you really have to do it, frames would be the simplest way, so I'd do that. But you're not going to do it anyway, right?

Alex Fort
I disagree. When I visit a band's website, chances are I want to hear their music.I agree, don't start it automatically. But once you hit "play", yes, it would be very nice to be able to browse the site without killing the music.
levand
This is true, but if I go to a band's website, I expect to hear music WHEN I REQUEST it.
Jason Baker
When I go to a band's website, I expect to leave within 2-3 seconds. I have yet to see one that didn't suck an inordinant amount of nard. I can see how a media player app would be well suited, however. Background music on a website, to me, is just evil IMHO.
Alex Fort
I agree with Jason. I don't want to hear the music when as soon as I go to the website. I want to hear the music when I request it. Not when I'm looking up tour dates. What happens when I'm already listening to music?
Kibbee
a band website without music would be idiotic. on-demand over default audio is, however, a must
spender
I thought the same thing. Unfortunately, the band members need the site to play background music. I will be sure to allow the users the ability to turn off the music from within the frame.
Seedorf
Having chosen the bad practice of playing unsolicited (unstoppable!) music, I say, stay the course and go with the frames as well. In time, you can work up to the ultimate horror that is Flash. Oh, and be sure to put it on the home page...
gbarry
If I were you, I'd also put up some flashing text in a marquee, and add one of those popups that say Copyright when you hit the right mouse button. Oh, and hide the menu bar and address bar while your at it.
Brent.Longborough
+1, I hate it when music starts playing when I hit a website.
R. Bemrose
A: 

This may be a topic for another post, but why would you cosnider IFrames to be good practice? you could out the content you want to change into an IFrame and have your code running your music player ouside it. When you load a page it woul load on the IFrame. Just a thought...

Andres
i meant "NOT be a good practice".. sorry
Andres
+1  A: 

It wouldn't be pretty but you could do it using AJAX. Have the master page with the header/footer/navigation controls with a big empty content div, and instead of regular links you have calls to AJAX functions that return HTML to be injected in the content div.

I tend to agree with the others who recommend frames. It may be considered "bad practice", but so is playing background music in the first place.

CodeMonkey1
A: 

I can think of four ways:

  • Frames, as you said.
  • Make your entire website in Flash and have only one page. You need to know Flash to be able to do this, which could make this difficult.
  • Pop-out your music player. This is probably the easiest approach, but the downside is this could be annoying, and a lot of web browsers these days would block it.
  • Use AJAX and dynamically load all your site content within one page, like Gmail. Users will need to have newer browsers, and this will take quite a bit of coding on both the client and the server side.
Ray Hidayat
Actually, popping out the music player wouldn't be a bad idea. It would make it easy for the user to stop the music, and it wouldn't require any fancy trickery to get the music to play continuously.
Kibbee
It just requires that they aren't blocking pop-ups and will accept the new window. Most won't.
Syntax
Most will accept it fine when the player pops up in response to a user click.
bobince
A: 

As was said, to do that you have to prevent your website from relaoding.

An option to achieve this might be to use asynchronous requests to modify your website content without reloading the whole page, that's basically what Ajax is about.

That being said, I sort of agree with Alex here : dont' play music.

Axelle Ziegler
it's a website for a band... if music is acceptable anywhere it's on a music related website, no? I'd concur that an on-demand model is preferable to defaulting to audio.
spender