A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: Can't load MP3!!!

Hybrid View

  1. #1
    Junior Member
    Join Date
    Dec 2002
    Posts
    24

    Can't load MP3!!!

    Hello all,

    I have a simple code to play MP3 audio file. Some MP3 are played very well, but some are not. I don't know why. Could anyone give me a hand?

    Code:
    var mySound = new Sound();
    function playSound() {
    	var soundFile = "As long as you love me.mp3" ;
    	mySound.loadSound(soundFile, true);
    	mySound.start();
    }
    
    playSound();
    Thanks,
    tuyle

  2. #2
    Flashkit historian Frets's Avatar
    Join Date
    Oct 2000
    Location
    flashkit
    Posts
    8,797
    maybe it's your mp3
    not all mp3's are created equal.

    example swf format doesn't allow for the import
    of variable bit rate mp3s

    It also only allows for standardized mp3 encoding
    5,000
    11,025
    22,050
    44,100

    If your sample rate doesn't match these it won't work.

    Frets

  3. #3
    Harmony & Justice Veniogenesis's Avatar
    Join Date
    Jul 2002
    Location
    Washington D.C.
    Posts
    4,434
    Just as a little note.

    If it is indeed a sample rate problem,
    you can use a audio converter to convert
    the file to another sample rate.

    I'm sure Frets knowns of some better
    audio converters (), but I personally
    use Goldwave. (www.goldwave.com)
    Flash Kit Moderator . Duke University
    Thomas Jefferson High School for Science and Technology

  4. #4
    Senior newbie Ozzworld's Avatar
    Join Date
    Oct 2001
    Location
    Phoenix, Arizona
    Posts
    481
    ahh good old goldwave, great little program


    Ozzie

  5. #5
    Junior Member
    Join Date
    Dec 2002
    Posts
    24
    I also guested that is the sample rate problem. Because when I used "lame.exe" tool (http://www.mp3dev.org) to convert to a new MP3 file, Flash ran OK!

    This tool is a free command-line application, can convert all most audio formats to MP3. However, it takes much time when convert BIG SIZE audio files, example MP3 (about 3.5 MB) or WAV. Do anyone has another free command-line too that can convert quickly?

    Thanks,
    tuyle

  6. #6
    Flashkit historian Frets's Avatar
    Join Date
    Oct 2000
    Location
    flashkit
    Posts
    8,797
    The lame encoder is part of swish.
    It's what swish uses in converion of wav to mp3 internally

    Now I clearly see what the issue is.

    Swish can't stream.
    When you have a large swf that is so because
    of the audio files. the audio portion won't run
    untill it's fully downloaded.

    This makes for a very large swf.

    AFAIK
    Swish max does not support the load external sound
    function found in flash mx.

    For situations such as that you would need a program that
    converts mp3 to streaming media format.

    Frets

  7. #7
    Junior Member
    Join Date
    Dec 2002
    Posts
    24
    Hello all,

    Let me confirm somethings can make you confuse:

    1/ I use Flash MX, not Swish
    2/ I use "lame" to convert all audio format to MP3, then use Flash loads MP3 externally
    3/ The problem is: some (already)MP3 files could not be loaded by Flash, although these MP3 files can be played by other media tool, example Winamp. I think the problem is sample rate (or other options: stereo, mono..... or somethings else) becuase when I use "lame" to convert these MP3 files to the new ones, Flash can load them OK
    4/ Because of the big size of MP3 (or other audio files), "lame" take too much time (about 10s for a 3.5MB MP3 file). I'm looking for another free command-line tool that can convert quickly. Now I have a temporary solution: use some oftions of "lame" ( -f: fast, but low quality; -m m: mono audio) and "lame" takes only 5s to convert 3.5Mb MP3 file and the new size is 1.6Mb!!! Because I don't care too much on the quality of audio, so this solution may be acceptable.

    If all of you have any ideas, please share me.
    Thanks,
    tuyle

  8. #8
    Junior Member
    Join Date
    Jul 2003
    Location
    hamilton, ON
    Posts
    10
    Frets said:
    "Swish can't stream.
    ... the audio portion won't run
    untill it's fully downloaded."

    How can I control a preloader to know when the audio portion is downloaded? is it simply that the frame on which playsound() is issued will not advance until sound is loaded, or do the sound and video frame timings become disconected at this point?

    I am very confused about this sound issue.

  9. #9
    Flashkit historian Frets's Avatar
    Join Date
    Oct 2000
    Location
    flashkit
    Posts
    8,797
    Umm No wonder why al the confusion.

    This is the swish help forum.
    Not MX or Music & Sound.

    I believe hp3 has you answer
    FAQ #39 Why does Flash load mp3 when I test the FLA but not when I use the web browser player

    A: The web browser player has security restrictions allowing it to only interact with media loading from the same domain. Flash will not allow you to stream or load mp3 from coolmp3s.com unless your SWF is also on the coolmp3s.com server.

    It may be possible to configure Flash using ActionScript or XML permission files to allow mp3 streaming from a subdomain. For example you may be able to stream mp3 from a shoutcast or icecast server at mydomain.shoutcast.com if your SWF is hosted on mydomain.com.

    The standalone player (used for testing SWF in Flash IDE) and projector can load media from any url and do not have this same limitation as the web browser player.

    For more information read the security model article at Macromedia
    http://flashkit.com/board/showthread...0&pagenumber=2

    Frets

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

HTML5 Development Center