When playing AAC files, you have access to metadata information that can be useful for your application. In this example, we are tracing the duration and the codec:
import flash.net.NetConnection;
import flash.net.NetStream;
var connection:NetConnection;
connection = new NetConnection();
connection.connect(null);
var stream:NetStream = new NetStream(connection);
// define the stream client property
var metaObject:Object = new Object();
metaObject.onMetaData = onGetMetaData;
stream.client = metaObject;
stream.play(“someAudio.m4a”);
function onGetMetaData(data:Object):void {
// audio duration
trace(data.duration*1000, “milliseconds”);
// codec
trace(data.audiocodecid);
for (var prop:String in data) {
trace(prop, data[prop]);
}
}
Audio Example Using Multitouch
You can develop a musical instrument or device to trigger audio and music. Android devices only support two simultaneous touches; however, they support a range of gestures.
You can, for instance, use a left-to-right swipe gesture to turn the volume up and a right-to-left swipe gesture to turn the volume down.