I realize this idea is totally outdated but my client wants it and what the client wants most of the time the client gets. I figured out how to put music on the site and it works great and is fast. what i'm wanting to know is there a way to when the site loads there is a popup which says there is music do they want it to play or not. Me and a friend have the popup kinda working but the music plays regardless of the popup. I'll post the pen in a little bit.
The pen is here: http://cdpn.io/xIKFw
Sorry but I don't have time to post the images so the css won't work right. If you cant figure it out without them let me know and ill post them when I get a chance.
var selection = window.confirm('This page has sound on it. Confirm to play'),
testTrack = document.getElementById('audio');
if(selection == true) {
testTrack.load();
testTrack.play()
}
That doesn't sort out your pause link quite yet (can add if needed), but it does make it so it will only start playing if they click OK at the confirmation. If you need anymore help let me know. Interestingly also, I couldn't just update the codepen because confirm doesn't seem to run.
I do kinda agree with @chrisburton too though in that having a big popup when the page loads is obtrusive and may hinder good UX. But hey, if that's what you need that's fine I guess :)
@tomrogers123 I disagree. I don't think it's "fine" to force a user to have to automatically get rid of an unnecessary popup. Especially every time you visit the site (unless he's using a cookie).
@chanman Let us know what your client comes back with in case you need help convincing.
@eric my problem with it is what if somebody opens it up in there office or even better in the library and the speakers were left to high from the last person that's going to scare them to death.
@paulie_d thanks for backing me up on this I think were totally right.
My point is its a personal choice. I'm not fan of all the telling that goes on with music. Take one of my personal sites for instance. This was fun site I did for myself basically. Guess I just didn't care about the people that go to libraries to surf. Plus it fits this site. Or at least that's the type of vibe I wanted to give off. http://www.ericwwatson.com/
One other thing....If you go down the route of NOT having sound by default then then the option should be given in a special section of the page (perhaps in the header or at the top of an aside) to say something like..."We have sound...click here to enable".
It does depend on what the client wants. Note though that if you do it off and give the option to turn it on you mine as well not have music. Probably only 2% of people would bother to turn it on.
Probably only 2% of people would bother to turn it on.
That should tell you something.
Obviously if it's a music focused site then a big warning saying "For the best experience you will need to enable sound on this site" is a good idea...but by default?...Never.
Couldn't agree more @chanman. I'm new around here and have no wish to make enemies but I just think that, because clients are paying us money to do something, we should do it. It should be part of our responsibility to them to advise them on the best way to do things on the web and give good reasons why their original idea may be a bad move and what they could do to better serve their users. Ultimately however, if we call ourselves web designers we should do anything people want that involves developing on the web (personally I'd draw the line at table-based layout though!). Hence me providing the code I did.
I'm not going to get into the debate (I think it's a situational thing), but if you give them an option to turn it on, also give them an option to turn it off if they have turned it on. Listening to the same short loop of music or the client's radio ad gets really old after a while.
Back in the days when inflicting music on your viewers was the "in" thing, weren't there options provided usually for turning the music on or off at will?
I realize this idea is totally outdated but my client wants it and what the client wants most of the time the client gets. I figured out how to put music on the site and it works great and is fast. what i'm wanting to know is there a way to when the site loads there is a popup which says there is music do they want it to play or not. Me and a friend have the popup kinda working but the music plays regardless of the popup. I'll post the pen in a little bit.
The pen is here: http://cdpn.io/xIKFw Sorry but I don't have time to post the images so the css won't work right. If you cant figure it out without them let me know and ill post them when I get a chance.
It would be easy to give the user a warning using JavaScript. You could attach an event handler to the document and run this when it was ready:
You could then write logic that. if they confirmed, would fire the audio playing (only if you have a JS API).
I don't really know but just a little js so your probably going to have to do this in baby steps.
I would talk the client out of it. Just because the client likes it doesn't mean majority of his user base will. And that's what is important.
Playing around, this JS seems to work:
That doesn't sort out your pause link quite yet (can add if needed), but it does make it so it will only start playing if they click OK at the confirmation. If you need anymore help let me know. Interestingly also, I couldn't just update the codepen because confirm doesn't seem to run.
I do kinda agree with @chrisburton too though in that having a big popup when the page loads is obtrusive and may hinder good UX. But hey, if that's what you need that's fine I guess :)
Thanks guys I'm probably going to try and talk him out of it but this would still be a good thing to know how to do.
Smart move I think!
@tomrogers123 I disagree. I don't think it's "fine" to force a user to have to automatically get rid of an unnecessary popup. Especially every time you visit the site (unless he's using a cookie).
@chanman Let us know what your client comes back with in case you need help convincing.
@tomrogers123 where would I need to put that code in this code:
Just allow them to turn it off. That's all you need
Nope...give them the option to turn it on....much better.
Depending on the site. Sometimes it fits.
Strongly disagree. I surf... a lot...and I can't think of a single site I have EVER visited that would benefit from having sound activated by default.
@eric my problem with it is what if somebody opens it up in there office or even better in the library and the speakers were left to high from the last person that's going to scare them to death.
@paulie_d thanks for backing me up on this I think were totally right.
My point is its a personal choice. I'm not fan of all the telling that goes on with music. Take one of my personal sites for instance. This was fun site I did for myself basically. Guess I just didn't care about the people that go to libraries to surf. Plus it fits this site. Or at least that's the type of vibe I wanted to give off. http://www.ericwwatson.com/
@eric ok i'll agree but i think you have to think about what kind of song it is also and how loud it's going to play on default.
One other thing....If you go down the route of NOT having sound by default then then the option should be given in a special section of the page (perhaps in the header or at the top of an aside) to say something like..."We have sound...click here to enable".
I hate anything that pops up.
@paulie_d I'll agree with that also I guess it just depends on what the client really wants.
It does depend on what the client wants. Note though that if you do it off and give the option to turn it on you mine as well not have music. Probably only 2% of people would bother to turn it on.
That should tell you something.
Obviously if it's a music focused site then a big warning saying "For the best experience you will need to enable sound on this site" is a good idea...but by default?...Never.
Ok guys Now I think ya'll are just being mean.
Couldn't agree more @chanman. I'm new around here and have no wish to make enemies but I just think that, because clients are paying us money to do something, we should do it. It should be part of our responsibility to them to advise them on the best way to do things on the web and give good reasons why their original idea may be a bad move and what they could do to better serve their users. Ultimately however, if we call ourselves web designers we should do anything people want that involves developing on the web (personally I'd draw the line at table-based layout though!). Hence me providing the code I did.
I'm not going to get into the debate (I think it's a situational thing), but if you give them an option to turn it on, also give them an option to turn it off if they have turned it on. Listening to the same short loop of music or the client's radio ad gets really old after a while.
Back in the days when inflicting music on your viewers was the "in" thing, weren't there options provided usually for turning the music on or off at will?
@tomrogers123 Your exactly right and welcome to the forums I've only been on here for about 2 years.