1 Reply Latest reply on Aug 1, 2008 2:51 AM by anirudhs

    Playing AAC files in air

    Steve Brewer
      I'm trying to play unprotected aac files (iTunes plus downloads or files ripped from iTunes) in an AIR app. Code looks like this:


      var f : File = new File();
      f.addEventListener('select', function(e : Object) : void {
      trace('you selected ' + f.name);
      var r:URLRequest = new URLRequest(f.url);
      var s:Sound = new Sound();
      s.addEventListener('complete', function(e:Event):void{
      trace('file is loaded, about to play');
      try{
      var sc:SoundChannel = e.target.play();
      trace(sc.position);
      sc.addEventListener('soundComplete', function(e:Event):void{trace('sound is done');});
      }catch(e:Error){
      trace('Error: ' + e);
      }
      });
      s.load(r);
      });
      f.browseForOpen('Select a Song');


      The sounds loads without error and then immediately calls soundComplete. Flash version (according to flash.system.Capabilities.version) is MAC 9,0,115,0.

      Thanks for the help!