User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 370,605 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,039 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 3656 | Replies: 6
Reply
Join Date: Aug 2005
Posts: 100
Reputation: martinkorner is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
martinkorner's Avatar
martinkorner martinkorner is offline Offline
Junior Poster

Question Background music start

  #1  
Dec 20th, 2005
I have some music in the background of my website (Let it snow.mp3) - using the following code:

<script language="JavaScript"><!--
if(navigator.appName=="Netscape"){
document.write('<embed src="let it snow.mp3" autostart="true" loop="true" controls="SmallConsole" width=50 height=15></embed>');}
else if(navigator.appName=="Microsoft Internet Explorer"){
document.write('<embed src="let it snow.mp3" autostart="true" loop="true" width=70 height=25></embed>');}
else{
document.write('<embed src="let it snow.mp3" autostart="true" loop="true"></embed>');}
//-->
</script>
<noscript><embed src="let it snow.mp3" autostart="true" loop="true"></embed></noscript>
<noembed><bgsound src="let it snow.mp3" loop=true></noembed>



At the moment it starts playing automatically.

If the user is already listening to some music this can be annoying.

Would it be possible to have an alert box which comes up when the music is loaded saying something like:

Do you want to listen to "Let it Snow" by Chris Isaak while you browse my web site?
[Yes] [No]

Hope you can help

Martin
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2004
Location: H4x0rville
Posts: 2,105
Reputation: server_crash is on a distinguished road 
Rep Power: 9
Solved Threads: 18
server_crash's Avatar
server_crash server_crash is offline Offline
Postaholic

Re: Background music start

  #2  
Dec 27th, 2005
Why not set autostart to false and set hidden to false? I THINK that would give some sort of musical icon they can click on to listen.
Reply With Quote  
Join Date: Aug 2005
Posts: 100
Reputation: martinkorner is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
martinkorner's Avatar
martinkorner martinkorner is offline Offline
Junior Poster

Help Re: Background music start

  #3  
Dec 28th, 2005
The only thing wrong with that is if they don't see the player.

Martin
Reply With Quote  
Join Date: Feb 2008
Posts: 2
Reputation: Clawsy is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Clawsy Clawsy is offline Offline
Newbie Poster

Troubleshooting Re: Background music start

  #4  
Feb 22nd, 2008
I have a problem. on my website, a flash player plays a background sound but when I refresh it or i change the page, it stops like it is available only at that page. what can I do to hear that sound on multiple pages of my site? please help me
Reply With Quote  
Join Date: Aug 2005
Posts: 100
Reputation: martinkorner is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
martinkorner's Avatar
martinkorner martinkorner is offline Offline
Junior Poster

Solution Re: Background music start

  #5  
Feb 23rd, 2008
Originally Posted by Clawsy View Post
I have a problem. on my website, a flash player plays a background sound but when I refresh it or i change the page, it stops like it is available only at that page. what can I do to hear that sound on multiple pages of my site? please help me


Unless you make your entire site with flash, I think the only way to achieve this is to use frames - so your site pages run in one frame on a main page which just has that frame and your flash player on.

Hope this helps,
Martin
Reply With Quote  
Join Date: Feb 2008
Posts: 2
Reputation: Clawsy is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Clawsy Clawsy is offline Offline
Newbie Poster

Re: Background music start

  #6  
Feb 24th, 2008
Thanks but I do not use frames because its ruining the design I think. Someone told me another way but VERY VERY COMPLICATED. To use a session in php or something like that to register the 'time of the song' when I change the page and to resume it on the other page in that session. Is anyone who tried this complicated method? I do not know how to control the sound like that.
Reply With Quote  
Join Date: Jul 2006
Location: Deptford, London
Posts: 916
Reputation: MattEvans will become famous soon enough MattEvans will become famous soon enough 
Rep Power: 5
Solved Threads: 46
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Posting Shark

Re: Background music start

  #7  
Feb 24th, 2008
Err... you could remember where the song is and restart it at the correct place on every page; but getting it syncronized properly over the Internet will be hell. It would take a long time to implement, a long time to test, and might not ever work without noticeable gaps or jumps in the song.

A frame is probably your best bet. I wouldn't worry about it 'runing the design', no1 need ever see the frames, and theres no reason you can't place a conformant W3C strict XHTML page inside a conformant W3C frameset XHTML frameset document. The only issue with frames is you lose the ability to use the address bar effectively.
If it only works in Internet Explorer; it doesn't work.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JavaScript / DHTML / AJAX Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 6:32 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC