AirMicrophone is a native extension that aims to replace the Microphone class on iOS. The API’s goal is to write the same code than if using flash’s Microphone class, except that the developer will include a different class. The microphone class in the ANE has some methods that will not work, they are there to ensure the compatibility with its Flash equivalent.

The extension is able to record sounds and supports activity level monitoring.


import cc.fovea.ane.AirMicrophone.Microphone;

// Initialize the microphone
var mic:Microphone = (Microphone)(Microphone.getMicrophone());

// All this is ignored when using the ANE. Just here for compatibility.
mic.addEventListener(StatusEvent.STATUS, onMicStatus); 

// Start recording
mic.rate = 11; // (or any non-zero value)

// Retrieve activity level

// Stop recording
mic.rate = 0;
Air Native Extension, iOS . URL.