2 Replies Latest reply on Mar 24, 2011 9:29 AM by flexy_flex

    How do I know when a file loaded into a Sound object is invalid?

    flexy_flex

      I'm writing an app that allows the user to play various sound files.

      Some of these files are mp3, but some may also be ogg, wma, etc.  The selection is out of my control, so I need the sound API to tell me if it can't play something.

       

      To test, I loaded some test files into a sound object like so:

                      var urlRequest:URLRequest = new URLRequest("http://support.microsoft.com/support/MediaPlayer/wmptest/samples/new/mediaexample.wma");
                      var sound:Sound = new Sound();
                      var soundChannel:SoundChannel = sound.play();

       

      Even though Flex doesn't play wma's there is no error information or null objects anywhere.  Everthings seems to be fine to flex, I can even register for progress events and see the wma being loaded.

       

      Just to see how far this goes, I loaded a gif instead of an audio file and the same thing happened.  Progress went fine with no errors of any kind even though I registered for every listed event.  As expected though, no sound played from the gif file.

       

      What is the recommended way for checking if a file is not playable?