Results 1 to 6 of 6

Thread: NewB Question - Playing an MP3 as soon as a page loads

  1. #1

    Thread Starter
    Frenzied Member nishantp's Avatar
    Join Date
    Jan 2001
    Location
    Where you least expect me to be
    Posts
    1,375

    NewB Question - Playing an MP3 as soon as a page loads

    Can someone give me some code to play a certain MP3 as soon as the page loads? And where would i put such code?

    -Thanks
    You just proved that sig advertisements work.

  2. #2
    DaoK
    Guest
    I suppose you want an applet ? Cause if it's just javasscript I think you in the wrong forums

  3. #3
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    Im not too sure if java is able to handle mp3 formats but here are the formats that i know it can definetly handle. WAV,MIDI, AU,AIFF

    Audio clips are handled by an interface called AudioClip which all audio clips implement. You can use these methods on the audio clip which are found in the interface once the clip is retrieved.

    void loop()
    void play()
    void stop()

    Im assuming that you are using these in an applet so you would want to use the getAudioClip() methods for retrieving sound files specified by a given URL

    AudioClip getAudioClip(URL url)
    AudioClip getAudioClip(URL url, String filename)

    There are also to overloaded play methods that can retrieve an play the audio clip.

    void play(URL url)
    void play(URL url,String filename)

  4. #4
    Fanatic Member zmerlinz's Avatar
    Join Date
    May 2000
    Location
    in a world where the sun always shines on the bloody tv!!
    Posts
    604
    i am pretty sure that you need a codec to play the mp3, and Java is the worst thing to do this, as it plays the mp3 so slowly.

    Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
    -- Linus Torvalds

    [Galahtech.com] | [My Site] | [Fishsponge] | [UnixForum.co.uk]

  5. #5
    New Member
    Join Date
    May 2002
    Location
    NY
    Posts
    2
    y dont u just convert the mp3 file to a wav file useing something like music match jukebox and play the file as a wav in da background in da body tag or ur page

  6. #6
    DaoK
    Guest
    Originally posted by Strawberrys
    y dont u just convert the mp3 file to a wav file useing something like music match jukebox and play the file as a wav in da background in da body tag or ur page
    Because a mp3 is about 4 megs and a wav about 40megs

Posting Permissions

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



Click Here to Expand Forum to Full Width