SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    Resident Boozehound simontheak's Avatar
    Join Date
    Jun 2003
    Location
    _root.europe.uk.london
    Posts
    965
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Playing WAVs on request

    Hi there,

    I have a friend who is building his first website. He would like to have a "secret link" that would start to play a wav when a user rolls over it with the mouse or clicks on it. However, this music obviously wouldn't play as soon as the page loads up - only when someone finds his link.

    I'm guessing that this might involve JavaScript, but seeing as I wasn't sure I thought I'd post it in the HTML forum.

    Any suggestions anyone has would be really appreciated.

    Thanks,

  2. #2
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  3. #3
    Wanna-be Apple nut silver trophy M. Johansson's Avatar
    Join Date
    Sep 2000
    Location
    Halmstad, Sweden
    Posts
    7,400
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Moved to Javascript forum.
    Mattias Johansson
    Short, Swedish, Web Developer

    Buttons and Dog Tags with your custom design:
    FatStatement.com

  4. #4
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    some other tips for embeding sound that i've discovered.
    Use WMP where possible, it is the best, most responsive media player I have used.
    If you have short files to play onevent then the best way to preload them is to embed them at volume=0 autostart=true; then change the volume before the starting of the file.
    I now use this to play and stop files;
    Code:
    function Sound(sndAction,sndObj) {
    if(wmp) {
    if(sndAction=="play") {document.getElementById(sndObj).controls.play();}
    if(sndAction=="stop") {document.getElementById(sndObj).controls.stop();}} else {
    if(rp) {
    if(sndAction=="play") eval(sndObj).DoPlay()
    if(sndAction=="stop") {eval(sndObj).DoStop();eval(sndObj).SetPosition(0)}}}}
    I tried to make the real player more responsive using SetPosition(0) which should take it back to the start. Not much benefits.
    to change the volume you can use
    Code:
    if(wmp) document.getElementById(soundID).settings.volume=sndvolume
    if(rp) document.getElementById(soundID).setVolume(sndvolume)
    If you are an Opera user although you can embed sound it doesn't register in the browser as an object, so getElementById or getElementsByTagName will not read the embeded object.
    My drum page at www.unitingrhythms.co.uk/drums/rhythms.html shows what can be acheived with the WMP9 series.
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if


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
  •