6

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.

Matthieu Brucher
  • 21,634
  • 7
  • 38
  • 62
Seedorf
  • 665
  • 3
  • 13
  • 28
  • Wow, this is the best web design forum on the planet. I didnt expect so many answers in such a short space of time. – Seedorf Feb 09 '09 at 21:50
  • 1
    If you must do this, be sure to put a STOP button, and preferably a VOLUME button in plain sight. – scunliffe Feb 09 '09 at 22:32
  • If you think Google image search uses Frames you are wrong. You typically can't tell frame from overflowed divs when looking at them unless you open the source code. Google would never uses frames and neither should you. –  Apr 06 '11 at 20:53

7 Answers7

22

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?

GEOCHET
  • 21,119
  • 15
  • 74
  • 98
Alex Fort
  • 18,459
  • 5
  • 42
  • 51
  • 6
    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 Feb 09 '09 at 21:24
  • 2
    This is true, but if I go to a band's website, I expect to hear music WHEN I REQUEST it. – Jason Baker Feb 09 '09 at 21:27
  • 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 Feb 09 '09 at 21:29
  • 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 Feb 09 '09 at 21:30
  • a band website without music would be idiotic. on-demand over default audio is, however, a must – spender Feb 09 '09 at 21:31
  • 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 Feb 09 '09 at 21:53
  • 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 Feb 09 '09 at 21:56
  • 2
    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 Feb 09 '09 at 22:29
  • +1, I hate it when music starts playing when I hit a website. – Powerlord Feb 27 '09 at 18:00
5

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
  • 16,055
  • 4
  • 37
  • 43
  • 1
    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 Feb 09 '09 at 21:33
  • It just requires that they aren't blocking pop-ups and will accept the new window. Most won't. – Syntax Feb 09 '09 at 22:04
  • 1
    Most will accept it fine when the player pops up in response to a user click. – bobince Feb 10 '09 at 03:10
3

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.

Brandon
  • 13,956
  • 16
  • 72
  • 114
3

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.

Misko
  • 2,044
  • 12
  • 15
0

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
  • 2,505
  • 17
  • 19
  • 1
    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 Feb 09 '09 at 21:29
-1

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
  • 192
  • 1
  • 14
-4

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
  • 1,314
  • 1
  • 7
  • 14
  • 6
    As a user, I'd rather see frames than a pure-Flash website any day. – MusiGenesis Feb 09 '09 at 21:12
  • 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 Feb 09 '09 at 21:16
  • 2
    -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 Feb 09 '09 at 21:38
  • 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 Feb 09 '09 at 21:45
  • 3
    @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 Feb 09 '09 at 21:58
  • 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 Feb 09 '09 at 22:00
  • 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 Feb 09 '09 at 22:03
  • 3
    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. – Hejazzman May 28 '09 at 09:58