SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 26
  1. #1
    SitePoint Enthusiast
    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?

  2. #2
    American't awestmoreland's Avatar
    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>
    Bear in mind however that I've only tested this in IE so it may not be cross-browser compatible.

    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.


    Andy
    From the English nation to a US location.

  3. #3
    SitePoint Enthusiast
    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

  4. #4
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    ".ram" files are for RealPlayer.

  5. #5
    SitePoint Enthusiast
    Join Date
    Jan 2003
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    help!!!

    so what kind of file can i use

  6. #6
    SitePoint Enthusiast
    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!!!!!!!

  7. #7
    SitePoint Enthusiast
    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.
    --
    Chris Bryant
    Bryant RV

  8. #8
    WebAmoeba mythix's Avatar
    Join Date
    Aug 2002
    Location
    here
    Posts
    578
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.asp
    Laws 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

  9. #9
    SitePoint Enthusiast
    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.

  10. #10
    SitePoint Enthusiast
    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

  11. #11
    SitePoint Enthusiast
    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

  12. #12
    Sidewalking anode's Avatar
    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.

  13. #13
    SitePoint Enthusiast
    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

  14. #14
    SitePoint Enthusiast
    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.

  15. #15
    SitePoint Enthusiast
    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

  16. #16
    SitePoint Enthusiast
    Join Date
    Jan 2003
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok choi-rho, on-off button it is then

  17. #17
    SitePoint Enthusiast
    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

  18. #18
    code ninja hamstu's Avatar
    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
    He He, Ditto

  19. #19
    Fully Sweet Car noddy's Avatar
    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

  20. #20
    SitePoint Enthusiast
    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

  21. #21
    SitePoint Enthusiast
    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

  22. #22
    SitePoint Enthusiast
    Join Date
    Jan 2003
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    thanks

    thanks a lot,it works a treat

  23. #23
    SitePoint Enthusiast
    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

  24. #24
    SitePoint Member
    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>

  25. #25
    SitePoint Evangelist Ed Seedhouse's Avatar
    Join Date
    Aug 2006
    Location
    Victoria, B.C. Canada
    Posts
    592
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wanderlywagon
    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.
    Let's hope no one tells you unless you are the only person who will ever visit your site. If you want anyone else to this is, in my opinion, simply an abusive practice.

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •