Adobe
Products

Top destinations

  • Adobe Creative Cloud
  • Creative Suite
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • SiteCatalyst
  • Students
  • Elements family

Adobe Creative Cloud

  • What is Adobe Creative Cloud?
  • Design
  • Web
  • Photography
  • Video
  • Students
  • Teams
  • Enterprise
  • Educational institutions

Design and photography

  • Photoshop
  • Illustrator
  • InDesign
  • Adobe Muse
  • Lightroom

Video

  • Adobe Premiere
  • After Effects

Web development and HTML5

  • Edge Tools & Services [opens in a new window]
  • Dreamweaver
  • Gaming [opens in a new window]

Adobe Marketing Cloud

  • What is Adobe Marketing Cloud?
  • Digital analytics
  • Social marketing
  • Web experience management
  • Testing and targeting
  • Media optimization

Analytics

  • SiteCatalyst
  • Adobe Discover
  • Insight

Social

  • Adobe Social

Experience Manager

  • CQ
  • Scene7

Target

  • Test&Target
  • Recommendations
  • Search&Promote

Media Optimizer

  • AdLens
  • AudienceManager
  • AudienceResearch

Document services

  • Acrobat
  • EchoSign [opens in a new window]
  • FormsCentral [opens in a new window]
  • SendNow [opens in a new window]
  • Acrobat.com [opens in a new window]

Publishing

  • Digital Publishing Suite

  • See all products
Business solutions

By business need

  • Digital analytics
  • Digital publishing
  • Document management
  • Media optimization
  • Social marketing
  • Testing and targeting
  • Video editing and serving
  • Web development [opens in a new window]
  • Web experience management
  • See all business needs

By industry

  • Broadcast
  • Education
  • Financial services
  • Government
  • Publishing
  • Retail
  • See all industries
Support & Learning

I need help

  • Products
  • Adobe Creative Cloud
  • Adobe Marketing Cloud
  • Forums [opens in a new window]

I want to learn

  • Training and tutorials
  • Certification [opens in a new window]
  • Adobe Developer Connection
  • Adobe Design Center
  • Adobe TV [opens in a new window]
  • Adobe Marketing Center
  • Adobe Labs [opens in a new window]
Download
  • Product trials
  • Adobe Flash Player
  • Adobe Reader
  • Adobe AIR
  • See all downloads
Company
  • Careers at Adobe
  • Investor Relations
  • Newsroom
  • Privacy
  • Corporate Social Responsibility
  • Customer Showcase
  • Contact us
  • More company info
Buy
  • For personal and professional use
  • For students, educators, and staff
  • For small and medium businesses
  • Volume Licensing
  • Special offers
  • Adobe Marketing Cloud sales [opens in a new window]
Search
 
Info Sign in
Why sign in? Sign in to manage your account and access trial downloads, product extensions, community areas, and more.
Welcome,
My Adobe
My orders
My information
My preferences
My products and services
Sign out
My cart
Privacy My Adobe
Adobe
Products Sections Buy   Search  
Solutions Company
Help Learning
Sign in Sign out Privacy My Adobe
Preorder Estimated Availability Date. Your credit card will not be charged until the product is shipped. Estimated availability date is subject to change. Preorder Estimated Availability Date. Your credit card will not be charged until the product is ready to download. Estimated availability date is subject to change.
Qty:
Purchase requires verification of academic eligibility
Subtotal
Promotions
Estimated shipping
Tax
Calculated at checkout
Total
Review and Checkout
Adobe Developer Connection / Adobe AIR Developer Center /

Building a native extension for iOS and Android – Part 1: Getting started with volume control

by Nathan Weber

Nathan Weber
  • digitalprimates.net

Content

  • The challenge: Changing the system media volume
  • The solution: A volume native extension
  • Where to go from here

Created

27 August 2012

Page tools

Share on Facebook
Share on Twitter
Share on LinkedIn
Bookmark
Print
ActionScriptAdobe AIRAndroidextensibilityFlash BuilderiOSmobilenative extensions
Was this helpful?
Yes   No

By clicking Submit, you accept the Adobe Terms of Use.

 
Thanks for your feedback.

Requirements

Prerequisite knowledge

This series of tutorials is designed for developers with an intermediate to advanced understanding of ActionScript 3 and building Adobe AIR applications. Familiarity with Flash Builder, Java, and Objective-C will also be helpful.

 

Additional required other products

  • Volume Native Extension

User level

Intermediate

Required products

  • Flash Builder (Download trial)
  • Adobe AIR SDK

Lately, I've been focused on writing native extensions for Adobe AIR. The project I'm currently working on requires numerous custom behaviors, many of which I could only deliver using native extensions. I've learned a great deal, particularly since I haven't coded extensively with iOS or Android.

In this tutorial series, I share what I've learned and show you how to create your own AIR native extension for both iOS and Android. At the end of the series you will have a fully functional and useful native extension. You can also download the completed extension for your own use via the GitHub link above or at the end of this tutorial.

The challenge: Changing the system media volume

Changing the volume of a video while it's playing in Flash Player in a web browser is easy, particularly if you're using Open Source Media Framework (OSMF). You simply change the value assigned to MediaPlayer.volume . Unfortunately, when the video is playing in an Adobe AIR application on a mobile device, changing the value assigned to MediaPlayer.volume does not produce the behavior that you might expect.

Both Android and iOS have a system-wide media volume. Pressing the hardware volume buttons while media is playing causes the media volume to be adjusted. The system volume is applied to the Adobe AIR application and overrides the volume set by the user within the Adobe AIR application. This leads to a problem when the AIR application is set at full volume, but the system media volume is muted. If you want to use a slider control in your application to control the audio (or if you have any UI elements or logic that is based off of the volume) you're in trouble as you will be accessing the wrong volume.

The solution: A volume native extension

To solve this problem, you can create a native extension that interacts with the native layer to modify the system media volume, instead of using the usual methods within AIR to change the volume.

The volume native extension must have two parts. The first part is a method that can be called in AIR to adjust the system volume. The second part is a mechanism for notifying AIR whenever the user changes the system volume, either by using the hardware volume buttons or by using a different application.

The native extension has four parts:

  • the ActionScript library
  • a default implementation written in ActionScript
  • the iOS native code
  • the Android native code

The next three tutorials in this series will walk through each part, discussing how to write the code and potential pitfalls to consider. In the final part I cover building the ANE file.

Where to go from here

If you are only interested in using the finished volume native extension you can get it here.

Note: If you plan on using the extension on iOS you must compile the IPA (both debug and release versions) from a Mac. It is possible to specify an external iOS SDK on Windows with AIR 3.3; however, Flash Builder for Windows does not yet support this option. You must also specify the location of the iOS SDK in the native extension settings for iOS in Flash Builder. If you'd like more information on why that is or how to do it, see Part 3 of this series.

To learn how to build the ActionScript library and the default implementation, proceed to Part 2 of this series.

Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Unported License.

More Like This

  • Developing cross-platform Adobe AIR applications
  • Performance-tuning Adobe AIR applications
  • Using Badger for Adobe AIR applications
  • Building a native extension for iOS and Android – Part 2: Developing the ActionScript library
  • Creating your first Adobe AIR application on Android
  • Using web fonts with Adobe AIR 2.5
  • Signing Adobe AIR applications
  • Using push notifications in AIR iOS apps
  • Building Lupo: A case study in building commercial AIR applications
  • Using the Push Notifications native extension for iOS

Products

  • Adobe Creative Cloud
  • Creative Suite
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • Digital Publishing Suite
  • Elements family
  • SiteCatalyst
  • For education

Download

  • Product trials
  • Adobe Reader
  • Adobe Flash Player
  • Adobe AIR

Support & Learning

  • Product help
  • Forums

Buy

  • For personal and professional use
  • For students, educators, and staff
  • For small and medium businesses
  • Volume Licensing
  • Special offers

Company

  • News room
  • Partner programs
  • Corporate social responsibility
  • Career opportunities
  • Investor Relations
  • Events
  • Legal
  • Security
  • Contact Adobe
Choose your region United States (Change)
Choose your region Close

North America

Europe, Middle East and Africa

Asia Pacific

  • Canada - English
  • Canada - Français
  • Latinoamérica
  • México
  • United States

South America

  • Brasil
  • Africa - English
  • Österreich - Deutsch
  • Belgium - English
  • Belgique - Français
  • België - Nederlands
  • България
  • Hrvatska
  • Česká republika
  • Danmark
  • Eastern Europe - English
  • Eesti
  • Suomi
  • France
  • Deutschland
  • Magyarország
  • Ireland
  • Israel - English
  • ישראל - עברית
  • Italia
  • Latvija
  • Lietuva
  • Luxembourg - Deutsch
  • Luxembourg - English
  • Luxembourg - Français
  • الشرق الأوسط وشمال أفريقيا - اللغة العربية
  • Middle East and North Africa - English
  • Moyen-Orient et Afrique du Nord - Français
  • Nederland
  • Norge
  • Polska
  • Portugal
  • România
  • Россия
  • Srbija
  • Slovensko
  • Slovenija
  • España
  • Sverige
  • Schweiz - Deutsch
  • Suisse - Français
  • Svizzera - Italiano
  • Türkiye
  • Україна
  • United Kingdom
  • Australia
  • 中国
  • 中國香港特別行政區
  • Hong Kong S.A.R. of China
  • India - English
  • 日本
  • 한국
  • New Zealand
  • 台灣

Southeast Asia

  • Includes Indonesia, Malaysia, Philippines, Singapore, Thailand, and Vietnam - English

Copyright © 2013 Adobe Systems Incorporated. All rights reserved.

Terms of Use | Privacy | Cookies

Ad Choices

Reviewed by TRUSTe: site privacy statement