Silencing audio on iOS with Ambient Audio Playback Mode

The aural experience of an application is just as impactful as the visual or gestural experiences. A good background score and sound control can be the making of a runaway hit, just as a bad one can ruin a perfectly great application. As a result, it’s very important to get the audio accompaniments of your application just right. In Adobe AIR, the SoundMixer.audioPlaybackMode property gives some control over the behavior of audio output. Now, in the upcoming Adobe AIR 3.4, the application developer has another option to fine tune audio output – the new Ambient AudioPlaybackMode. You can download Adobe AIR 3.4 beta from Adobe Labs.

Upto Adobe AIR 3.3, there were only two modes: Media and Voice. Both these modes play sound in a manner assuming that the sound is central to the operation of the application. In these modes, sound continues to play even when the application is in the background or if the screen is locked. Most importantly, sound played in these modes does not obey the hardware silent switch on iPhones and iPads.

The new Ambient AudioPlaybackMode in Adobe AIR 3.4  fills in the requirement for a sound that is just an accompaniment to your application, not its main purpose. On iOS, Ambient mode allows the user to silence your application by flipping the silent switch or locking the screen. To use Ambient mode, simply set the audioPlaybackMode property of the SoundMixer class to AudioPlaybackMode.AMBIENT.

import   flash.media.AudioPlaybackMode;
import   flash.media.SoundMixer;
SoundMixer.audioPlaybackMode  =  AudioPlaybackMode.AMBIENT;

Continue reading…

Xcode template for authoring ANEs

It just became easier to author AIR Native Extensions for iOS. An open source contribution has been made by someone that allows easier authoring of ANEs for iOS. The application is actually a template for Xcode that gives you a head start on ANE creation.

Make sure to try it out. Head over to project and documentation.

AOT or Interpreter

Traditionally, computer programs can be executed in three possible ways – interpreted, static (ahead-of-time) compilation and Just In time (JIT). In interpreted mode, the code is translated from high-level language to low level language during execution whereas in ahead-of-time compilation the high-level language code is converted to low-level machine code before hand. JIT (Just in time) compilation is a hybrid approach of the two. Here the code translation into native code occurs during the execution time and the translated code is cached so that this conversion need not be done every time. Obviously there is a small penalty when compared to ahead-of-time compilation as there is a cost associated with this translation.

After this brief introduction lets get into the Adobe AIR world and what is there in it for an iOS AIR developer. SWF content on all platforms other than iOS is JIT compiled, whenever possible. The swf is downloaded locally and JIT compiled where possible. Continue reading…

Debugging AIR applications over USB on iOS

With the release of AIR 3.3, it is now possible for developers to debug their iOS AIR applications over a USB cable on the device. Prior to this release developers had to use wifi for debugging an AIR application on the iOS Device. There were, however, a few limitations associated with wifi debugging.

1) A developer needs to have internet connection available all the time.
2) Both the device and the desktop machine must be on the same subnet.

This new capability will solve the above mentioned problems and will provide a seamless debugging experience to the user by just connecting the iOS device to a Mac or a Windows machine. Since this feature is not available in Flash Builder or Flash Professional at the moment, a developer has to perform certain steps to get the debugging over USB working.

The steps required to set up the debugging over USB are as follows:

Continue reading…

AIR iOS app packaging with Flash Tooling and AIR 3.3

If you are using iOS Native Extensions with AIR 3.3, you may find that your application does not get packaged when using Flash Builder/Flash Pro. This is because, when using native extensions, linker warnings are not suppressed, and Flash Builder/Flash Pro are not able to handle such large number of warnings, specifically on Windows. This issue will be fixed in the upcoming release of Flash Builder and Flash Pro.

In order to overcome this issue, you can include the platform descriptor file (platform.xml) in your ANE, which contains the following linker option:

<option>-w</option>

A sample platform descriptor file will look like this:

<platform xmlns="http://ns.adobe.com/air/extension/3.1">
 <sdkVersion>5.0</sdkVersion> 
 <linkerOptions> 
 <option>-w</option> 
 </linkerOptions> 
</platform>

Then, at the time of packaging the ANE, include the ADT switch -platformoptions, providing the path to the platform descriptor file. For example,

Continue reading…