View Full Version : Embedded WAV files
splash1950
08-17-2002, 09:43 PM
I've built pages with embedded WAV and MIDI files, and they work just fine. But there are those visitors who simply do not wish to hear anything playing whilst visiting these pages. Other than clicking the browser stop button, or disabling the browser's sound capability all together, or having an embedded player like WinMedia's CP on the page is there something else I can do.
I've seen some pages recently, done in Flash, that have a neat little icon/button on the page that simply turns the sound on or off as preferred.
Is there something I can do that's similar using HTML, CSS or JavaScripts?
~LjM~ :rolleyes:
zoobie
08-17-2002, 10:43 PM
Always have a 'off' button for unrequested muzik. It depends on your code you're using. Post it here so we can ammend it. :D
splash1950
08-17-2002, 11:36 PM
Here's the WAV code ...
<embed src="KOMI_loop2.wav" autostart="true" loop="false" hidden="true"></embed>
<bgsound src="KOMI_loop2.wav" loop="-1">
The MIDI is exactly the same except of course for the filename.
I know I can embed the WinMedia player, and have the control panel appear, which I do with MP3 files, and I know that if I change the HIDDEN variable to FALSE, that will bring the panel to the screen (right?) ... but I don't really want the panel to appear on these other pages.
Just a neat little button or graphic link will do nicely. If possible.
zoobie
08-19-2002, 12:07 PM
Using the script found here (http://javascriptkit.com/script/script2/soundlink.shtml), add <input type="button" value="STOP THIS HORRIBLE MUZIK!!!" onClick="stopSound(0)"> :D
splash1950
08-19-2002, 04:41 PM
Perfect!
It gave me some problems with another JavaScript goody I had in the page, but the sound control was more important.
So goodbye Fade Link hello Sound controls!
Now to massage the buttons, or use the following with my own img src file.
<A HREF="javascript:playSound(0);">Music On</A>
<A HREF="javascript:stopSound(0);">Music Off</A>
By the way, I needed to remove the BGSOUND tag to make it work. I guess that was implied (???).
Thanx a bunch... you've made a lot of fuss-budgets happy!
zoobie
08-19-2002, 08:25 PM
You can learn how to get all your javascripts to run on your page here (http://www.javascriptkit.com/javatutors/multiplejava.shtml). :D
splash1950
08-19-2002, 08:48 PM
Well it is perfect but for one little thing...
the sound file no longer 'loops'.
I've tried my best guesses as to where to place the LOOP param in the script but I either guess wrong and get a script error message, or it seems to load OK but no loop occurs.
I even found about the style params for changing the button and button text color which I never knew before.
SO I was rolling right along until... no loops!
So what's attached is what I have so far, maybe you can add the final piece to this puzzle.
splash1950
08-19-2002, 09:04 PM
Sorry I didn't see your new reply about multi scripts.
Yes, I've read that page before and used it successfully with most scripts I've jammed <G> into pages.
But this one particular script ( A Fading Link script from Kurt Grigg) is problematic. I've noticed that the scripts is doesn't get along with are usually those entertaining little things like stars shooting into the 'void' or blasting from out of the middle of your screen. You know useless crap like that <G>. Probably something about x/y starting positions (???) I dunno.
So I removed it from the page now in question, and sure enough the Sound Buttons worked. Hence, goodbye Fading Link...
I'll get to use it somewhere, someday <G>. No biggie.
This looping business is more important anyway.
zoobie
08-19-2002, 11:16 PM
Did you try:
<EMBED SRC='"+aySound[i]+"' AUTOSTART='FALSE' HIDDEN='TRUE' LOOP='TRUE'>
or
<EMBED SRC='"+aySound[i]+"' AUTOSTART='FALSE' HIDDEN='TRUE' LOOP='1'>
:D
splash1950
08-20-2002, 01:02 AM
Yes, both. Also loop='Infinite'...
That was the only place that seemed where such a variable would need, or want to be (Str += "<EMBED SRC='"+aySound[i]+"' AUTOSTART='FALSE' HIDDEN='TRUE'>").
Something to chew on for sure!
splash1950
08-20-2002, 01:48 AM
This will make it loop ...
Str += "<EMBED SRC='"+aySound[i]+"' 'AUTOSTART='FALSE' HIDDEN='TRUE' LOOP='TRUE''>"
But then the Music Off button doesn't work. And those are two single apostrophes after TRUE not quotation marks.
zoobie
08-20-2002, 05:18 AM
Lucky for you I've goofed around with this before. :D
Forget the player above and just use:
<embed id="muzik" width="0" height="0" autostart="false" loop="true" src="file.wav"></embed><br>
<A HREF="javascript: document.getElementById('muzik').play();">Music On</A>
<A HREF="javascript: document.getElementById('muzik').stop();">Music Off</A>
For a cool tiny player console, try this:
<EMBED src="file.wav" type="audio/wav" controls="smallconsole" autostart="false" loop="true" width="72" height="25" volume="100"></EMBED><br>
Now, you can use your fading text. :thumbsup:
splash1950
08-20-2002, 05:30 PM
I tried the first suggestion, cut-and-pasted as is, changed the WAV Filename and it either returned an error message (Line:0, Error:Property or method not supported) or crashed the app's (1st Page 2000) preview or IE6 with the saved HTML. ???
I went with the smallconsole, which worked great, figured how to dress it up a little with a TABLE and its attributes. Tested fine in 1st Page and IE6. Looped, stopped, volume - beautiful!) Even found a site that went into using only certain buttons and something called Mastersound... all of which worked to varying degrees of functionality.
Brought it up to Angelfire (GOD how I hate that host!) and it played but would not loop. The MIDI file loops just fine on it's page, but not the WAV.
Thanks for all the help, and it will serve me elsewhere, but I am not wasting any more time, mine or yours, on trying to work through another Angelfire glitch.
Thanks again. You guys are great!
zoobie
08-20-2002, 07:51 PM
It probably just crashed your editor. It works fine on the internet. :D
Need a better host without ads? Try looking here (http://www.freewebspace.net). :)
dr_em2001
08-20-2002, 08:02 PM
OR you could just have another page EXACTLY like your main page or whatever, but without the sound, and the "no music" link can take you to that page.
splash1950
08-20-2002, 09:39 PM
ZOOBIE -- It ain't my site! I joined and quit Angelfire in the space of one day some time ago. My site, I pay for quality and get it <G>. I'll pass that search URL on to the client.
DR EM 2001 -- I've already got three versions going for one site. High graphic content, medium, and a low-fat no-sugar-added versions coming off a pick-yer-poison 'welcome' page now. But we are of the same mind... there is no longer any music coming off the medium or (s)low versions... a looping WAV plays on only one page of the cable/dsl version and if they want to turn it off there's the browser button.
There's only one page shared by all that has an embedded WinMedia player for a weekly MP3 file selection, the site is for a new CD release. Visitors are forewarned that because it isn't streaming they should grab a snack, read some song lyrics at another page or do something else productive if they aren't using a high speed access. <G>
Yah can't please everyone, and the anti-music folks are in the minority... and it is a site for a music CD after all.
Thanks again.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.