SitePoint Sponsor |
|
User Tag List
Results 1 to 25 of 26
Thread: play music on my webpage
-
Feb 3, 2003, 08:45 #1
- Join Date
- Jan 2003
- Posts
- 29
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
play music on my webpage
plz culd sum1 help me with my problem.
when i enter my webpage,i want music to play for a certain amount of time.
prob is i don't know how to go about doing this.
i have winamp3 and some music downloaded into my file so what do i do next?
-
Feb 3, 2003, 09:14 #2
- Join Date
- Sep 2002
- Location
- Grand Rapids, MI
- Posts
- 1,168
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
This is the way that I would do it but I suspect that you'll also want to preload the sound file othewise your script may tell it to stop playing before it's even loaded/started:
Code:<html> <head> <script type="text/javascript"> <!-- var mychoonz="tiki4.mp3"; // File name var choonz_length=10000; // Milliseconds function start_sound(){ document.getElementById('soundz').src=mychoonz; window.setTimeout('stop_sound();', choonz_length); } function stop_sound(){ document.getElementById('soundz').src="#"; } //--> </script> </head> <body onLoad="start_sound();"> <bgsound id="soundz" src="#" autostart="true"> </body> </html>
You may want to search Google for the "Embed" tag and investigate further.
Of course, the easiest way to play music for a fixed length of time is to crop the music file to the length that you want with an editor.
AndyFrom the English nation to a US location.
-
Feb 3, 2003, 09:28 #3
- Join Date
- Jan 2003
- Posts
- 29
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
sorry for annoying you again
guess ur prob getting sick of me!
but am do i have the right player downloaded its name
is winamp3_0-full
and the music file is music1.ram
didn't work for me, so was thinking that i have wrong player downloaded but not sure
-
Feb 3, 2003, 13:10 #4
".ram" files are for RealPlayer.
-
Feb 3, 2003, 13:35 #5
- Join Date
- Jan 2003
- Posts
- 29
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
help!!!
so what kind of file can i use
-
Feb 4, 2003, 04:16 #6
- Join Date
- Jan 2003
- Posts
- 29
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
irish fool still stuck!
the full name of the player file i want to use is
winamp3_0-full.zip
and music i have is music1.ram.
if ram won't work what kind of music file can i use
and is the player file alright!!!!!!!
-
Feb 4, 2003, 07:04 #7
- Join Date
- Dec 2002
- Posts
- 29
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
You can either download Real Player to play the ram file, or use any one of a number od other audio files- mp3 probably being the most common.
To see what file types Winamp will play, go to options>file types.
-
Feb 4, 2003, 07:12 #8
mp3s and midi files are best for webapges (nice and small file format).
try www.flashkit.com and look for a link called loops, they've got some great short looping sound files!
Also you may want to look at <bgsound> instead of java, you can also embed stuff but i can't remember how. You CAN embed ram files.
RAM FILES:
http://www.psiweb-guide.aa.psiweb.co...ediaindex.html
BGSOUND:
http://msdn.microsoft.com/library/de...ts/bgsound.aspLaws are like sausages. You have much more respect for them if you haven't actually seen how they're made.
http://www.webamoeba.co.uk
-
Feb 5, 2003, 08:39 #9
- Join Date
- Jan 2003
- Posts
- 29
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
sorry again
sorry about this but it is my first time trying to add music onto a website and i'm absolutely lost.
have the player downlaoded(i think) called winamp3.zip
have music downloaded music01.wav
so plz can sumone write the code for it to execute.
-
Feb 5, 2003, 14:40 #10
- Join Date
- Jan 2003
- Posts
- 29
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
what is wrong with the code!!!!
<script language="Javascript" >
var mychoonz="music01.wav"; // File name
var choonz_length=10000; // Milliseconds
function start_sound()
{
document.getElementById('soundz').src=mychoonz;
window.setTimeout('stop_sound();', choonz_length);
}
function stop_sound()
{
document.getElementById('soundz').src="winamp3.zip";
}
</script>
<body onLoad="start_sound();">
<bgsound id="soundz" src="winamp3.zip" autostart="true">
it won't work, this is similar to what awestmoreland did
-
Feb 5, 2003, 22:28 #11
- Join Date
- Jan 2003
- Location
- Lying on the floor in a cold and darkened room
- Posts
- 30
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
for the love of god, PLEASE, no BG music on ANY website
" I will ascend into heaven, I will exalt my throne above the stars of God: I will sit also upon the mount of the congregation, in the sides of the north...I will ascend above the heights of the clouds; I will be like the most High. "-Isaiha 14:14-15
-
Feb 5, 2003, 22:54 #12
- Join Date
- Mar 2001
- Location
- Philadelphia, US
- Posts
- 2,205
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Agreed. You may as well just replace the sound stuff with window.close as teh effect will probably be the same.
-
Feb 6, 2003, 06:20 #13
- Join Date
- Jan 2003
- Posts
- 29
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
hellllllllllllllllllllp!
well, i still don't know how to go about doing it.
prac banging my head against the wall.
can anyone help
-
Feb 6, 2003, 09:30 #14
- Join Date
- Jan 2003
- Posts
- 29
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
altered my code but still same f****d up
<script language="Javascript" >
var mychoonz="music.wav"; // File name
var choonz_length=10000; // Milliseconds
function start_sound()
{
document.getElementById('soundz').src=mychoonz;
window.setTimeout('stop_sound();', choonz_length);
}
function stop_sound()
{
document.getElementById('soundz').src="winamp3.zip";
}
</script>
<body onLoad="start_sound();">
<embed src="music.wav" hidden=true autostart=true>
<noembed>
<bgsound src="music.wav">
</noembed>
*** where is that i am wrong***
the music file is called music.wav and the player is called winamp3.zip. have i them in the wrong place?
can anyone help.
people above told me not include bgsound but the best i have looked up does include it.
-
Feb 6, 2003, 10:12 #15
- Join Date
- Jan 2003
- Location
- Lying on the floor in a cold and darkened room
- Posts
- 30
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
first, you MUSt promise to include on"off" button, or no code
" I will ascend into heaven, I will exalt my throne above the stars of God: I will sit also upon the mount of the congregation, in the sides of the north...I will ascend above the heights of the clouds; I will be like the most High. "-Isaiha 14:14-15
-
Feb 6, 2003, 10:35 #16
- Join Date
- Jan 2003
- Posts
- 29
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
ok choi-rho, on-off button it is then
-
Feb 6, 2003, 18:38 #17
- Join Date
- Jan 2003
- Location
- Lying on the floor in a cold and darkened room
- Posts
- 30
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
i think it would be one of these...
\<!-- ONE STEP TO INSTALL RANDOM MIDI:
1. Paste the coding into the BODY of your HTML document -->
<!-- STEP ONE: Put this code into the BODY of your HTML document -->
<BODY>
<CENTER>
<SCRIPT LANGUAGE="JavaScript">
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
nummidi = 3
day = new Date()
z = day.getTime()
y = (z - (parseInt(z/1000,10) * 1000))/10
x = parseInt(y/100*nummidi,10) + 1
if (x == (1))
midi=("mid1.mid")
if (x == (2))
midi=("mid2.mid")
if (x == (3))
midi=("mid3.mid")
document.write('<EMBED SRC= ' + midi + ' autostart=true loop=true ')
document.write('volume=100 align="center" width=50 height=15 controls=smallconsole>')
// End -->
</SCRIPT>
</CENTER>
<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>
<!-- Script Size: 0.83 KB -->
you might also be interested in this one::
http://javascript.internet.com/misce...midi-menu.html
netscape::
<BGSOUND SRC="yourmidifile.mid"><!--For IE -->
<EMBED SRC="yourmidifile.mid" HIDDEN="True"><!--
i could be wrong. I probably am. but that's ooakay, as bg music is evil anyways^_^" I will ascend into heaven, I will exalt my throne above the stars of God: I will sit also upon the mount of the congregation, in the sides of the north...I will ascend above the heights of the clouds; I will be like the most High. "-Isaiha 14:14-15
-
Feb 8, 2003, 10:58 #18
- Join Date
- Nov 2002
- Location
- Montréal, Canada
- Posts
- 375
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally posted by Chi-Rho
for the love of god, PLEASE, no BG music on ANY website
-
Feb 11, 2003, 06:34 #19
- Join Date
- Aug 2002
- Location
- Perth, Western Australia
- Posts
- 759
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
If you are going to include sound in your webpage and you are going to instruct it to start automatically you should clearly give the user the option to stop the music playing also.
Some people HATE!!!! when music starts playing on a webpage me included (mainly because the music has no emphises or relevance to the page that its on).
Secondly if you are developing a page so that music will always play your best bet is to use a .wav file, now hold on yes a .wav file is the largest type of file to contain music in (as far as I know) but it is almost certian to run on most users machines. And using another file type will most certianly require a user to have a particular plug-in to hear the music so if that is the case it is wise to provide a link to where they are \ would be able to aquire the needed plug-in.
ok I hope that these comments aid you in your delima
-
Feb 11, 2003, 10:21 #20
- Join Date
- Jan 2003
- Posts
- 29
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
tanx choi roi
tanx for that choi-roi, its working a treat.
but just wondering,instead of where u know there's a different tune
playing at a certain time of day,the user could have a choice of what midi files he/she wants to listen to.
do u know how to go about that.
if not,its ok
-
Feb 12, 2003, 22:14 #21
- Join Date
- Jan 2003
- Location
- Lying on the floor in a cold and darkened room
- Posts
- 30
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
you mean this?
http://javascript.internet.com/misce...midi-menu.html" I will ascend into heaven, I will exalt my throne above the stars of God: I will sit also upon the mount of the congregation, in the sides of the north...I will ascend above the heights of the clouds; I will be like the most High. "-Isaiha 14:14-15
-
Feb 13, 2003, 07:33 #22
- Join Date
- Jan 2003
- Posts
- 29
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
thanks
thanks a lot,it works a treat
-
Feb 15, 2003, 02:33 #23
- Join Date
- Jan 2003
- Location
- Lying on the floor in a cold and darkened room
- Posts
- 30
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
" I will ascend into heaven, I will exalt my throne above the stars of God: I will sit also upon the mount of the congregation, in the sides of the north...I will ascend above the heights of the clouds; I will be like the most High. "-Isaiha 14:14-15
-
Oct 17, 2006, 03:33 #24
- Join Date
- Oct 2006
- Posts
- 1
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Here is an easy embedded music, play/pause and stop buttons javascript
Here is an easy embedded music, play/pause and stop buttons javascript
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
i = 2;
function swap() {
switch (i) {
case 1:
play_pause.src = "pause.gif"
document.tester.play()
i = 2
return(false);
case 2:
play_pause.src = "play.gif"
document.tester.pause()
i = 1
return(false);
}
}
function stopit()
{document.tester.stop(); play_pause.src = "play.gif"; i=1}
</script>
</head>
<body>
<EMBED NAME="tester" SRC="soundtrack.mp3" loop="true" MASTERSOUND HIDDEN=TRUE autostart=true>
<img name="play_pause" onClick="swap()" src="pause.gif"/>
<img src="stop.gif" onClick="stopit()"/>
</body>
</html>
-
Oct 17, 2006, 12:13 #25
- Join Date
- Aug 2006
- Location
- Victoria, B.C. Canada
- Posts
- 592
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by wanderlywagon
What if I'm happily listenting to something I find sublime and moving and I go to your page and you interrupt it with some dreck? Or what if I'm in an office and you make me subject my fellow workiers to your particular choice of dreck?
Please, unless you are the only one who will ever visit your site, just don't do it.Ed Seedhouse
Bookmarks