aac audio doesn't seem to work in AIR at all
I was looking at sample code from David Hassoun about how to play AAC sound files in Flash. His code in Flash works great. But the same code more or less, moved to an AIR Desktop project, fails completely, without any error message. A baffling situation. I am just trying to play a simple sound file, a trivial operation. I know the sound file exists, and can be found but nothing comes out of the speaker, and no messages from the stream system occur either.
Is this possibly due to an obsolete runtime of my AIR system? how does one locate the AIR version you are running? There are so many AIR runtimes sprinkled through my hard drive...
<pre>
public class SysSound extends Object
{
public static const TRACE_SOUND : Boolean = true;
public static var g_connection :NetConnection;
public static var g_stream :NetStream;
//================================
// on_metadata
//================================
// streaming video needs this kind of function
// callback function for meta data handling
private static function on_metadata( info:Object ):void
{
if (TRACE_SOUND) trace ("onMetaData was called!");
}
//================================
// play_external_aac
//================================
// play an external file (must specify the folder!)
// should be in m4a format
public static function play_external_aac (path : String) : void {
var fd :File;
fd = File.applicationDirectory;
fd = fd.resolvePath(path); // audio/xxxx.m4a");
if (TRACE_SOUND) trace ("about to play "+path+", exists="+fd.exists);
if (!fd.exists)
throw new ArgumentError ("can't find external sound "+path);
var customClient : Object = new Object();
customClient.onMetaData = on_metadata;
var nc:NetConnection = new NetConnection();
nc.connect(null);
var my_stream:NetStream = new NetStream(nc);
my_stream.client = customClient;
my_stream.play(fd.url)
// to stop the sound call channel.stop()
} // end func
</pre>
