Background sound plays once only? Is this possible.

  • Thread starter Thread starter Kootenay Photography
  • Start date Start date
K

Kootenay Photography

I searched the group but all the info on this is quite old.

Is there a way to have your background sound file play only once?

We have had a professional announcer create an voice over for our site
to recruit potential employees but would rather the sound not play
each time the index page is opened.

Is there a way to set the BG sound to only play once?

you can see what I mean here at http://www.sutco.ca

Thanks
 
Add loop="1" to the code, like this (disregard the path to the file below)

<bgsound src="file:///D:/My%20Documents/My%20Music/smoking.wav" loop="1">

Or when inserting the bgsound option in FP's Page Options dialog uncheck
Forever and enter the amt of times you want it to loop.

(PS...the preferred setting is NO bgsound)
 
I have it set to only play once, but when the visitor returns to the
INDEX page it plays again when I have that setting.

I set up my menus to go to an identical INDEX2 page with no BG sound
but that is a workaround. I was hoping there was different method.
 
Kootenay Photography said:
I have it set to only play once, but when the visitor returns to the
INDEX page it plays again when I have that setting.

I set up my menus to go to an identical INDEX2 page with no BG sound
but that is a workaround. I was hoping there was different method.

I have set some music on my index page http://tandcl.homemail.com.au/ with a
play button.

So then the choice is up to the viewer, and it only plays once each time

The code (JS) is very simple
function playSound(fname)
{
if (!fname)
fname = "audio/minuet.mid"
var x = document.getElementById("sound")
x.innerHTML = (!x.innerHTML ) ? '<embed src="' + fname + '" loop=false
autostart=true hidden>' : ''
}

It is executed by this HTML
<span id="sound"></span>
<input type="button" value="Play/Stop
Music"
onclick="playSound()" title="Play/Stop Music" />

The file played is audio/minuet.mid
 
Rob's advice will limit the sound to a single loop whilst the page is
open. To prevent the sound repeating on subsequent returns to the page
you need to use cookies or session variables. Session variables
requires server side coding such as asp, PHP, asp.NET etc., cookies
require JavaScript or server side scripting.

There are articles on using cookies at
http://irt.org/articles/script11.htm, and there is probably a page at
http://www.w3schools.com that will assist - w3schools.com site is down
at the moment (07:50GMT)
 
Back
Top