SoundExtension is a native extension to navigate iOS music player, navigate the device volume and listen to the remote controller. It allows the application to monitor changes in the player status, such as a new audio route (headphone, speaker, etc).
It is also possible to control the music playback, navigate among the songs using goToNext()
and goToPrev()
. There is a specific iPod API to control sound.
Sample
var sundex:SoundExtension=null; if(SoundExtension.isSupported()){ soundex= new SoundExtension(); soundExt.addEventListener(SoundExtensionEvent.IPOD_STATE_CHANGED,onStatus); soundExt.addEventListener(SoundExtensionEvent.REMOTE_CHANGE,onStatus); soundExt.addEventListener(DeviceVolumeChangeEvent.VOLUME_CHANGED,onVolumeChange); soundExt.start();//starts the native listeners trace("volume: "+soundex.setVolume(0.1));//volume is between 0-1 trace("AudioRoute is "+soundExt.getAudioRoute()+"\n") } protected function onStatus(event:StatusEvent):void { trace(event.code+" "+event.level+"\n"); }