Adobe
Products
Creative Suite
Photoshop Family
Acrobat Family
Flash Platform
Digital Marketing Suite
Digital Publishing Suite
More products
Solutions
Digital marketing solutions
Digital media solutions
Education
Financial services
Government
Web Experience Management
More solutions
Learning Help Downloads Company
Store
Adobe Store for home and home office
Education Store for students, educators, and staff
Business Store for small and medium businesses
Other ways to buy
Search
 
Info Sign in
Welcome,
My cart
My orders My Adobe
My Adobe
My orders
My information
My preferences
Sign out
Why sign in? Sign in to manage your account and access trial downloads, product extensions, community areas, and more.
Adobe
Products Sections   Search  
Solutions Company
Help Learning
Sign in Welcome, My orders My Adobe
Qty:
Purchase requires verification of academic eligibility
Subtotal
Review and Checkout
Adobe Developer Connection / Mobile /

Understanding video formats and controlling video volume in Flash Lite 3.x

by Hemantha Sharma

Hemantha Sharma
  • hsharma.com/tech

Content

  • Working with supported video formats and codecs
  • Controlling the volume of video during playback

Modified

11 May 2009

Page tools

Share on Facebook
Share on Twitter
Share on LinkedIn
Bookmark
Print
codecs Flash Lite mobile video

Requirements

Prerequisite knowledge

Basic understanding of the Flash authoring environment and prior experience developing mobile applications using Flash Lite 3.0 is recommended.

User level

All

Required products

  • Flash Professional CS4 (Download trial)

As mobile devices become more sophisticated, developers continue to stretch the boundaries of the content they deliver to handsets. Video delivery is one avenue that has a promising future in mobile devices, but there is still much trailblazing to be done to successfully present it over the current mobile networks. Recently I came across a question in the forums that asked for a method to control the volume of an embedded video in Flash Lite 2.0. This is clearly not possible. However, the challenge intrigued me and I investigated possible strategies for controlling the sound of digital video in mobile applications. I am writing this article to elaborate my findings in this area and to share a workaround that can be accomplished in Flash Lite 3.0 with the online community.

In addition, I'll also explain the different types of video formats that are involved (native and device video) and provide information about the currently supported codecs available for mobile developers.

Working with supported video formats and codecs

The addition of digital video to your mobile application adds significant value by offering the user a fully immersive experience. However, it is important to have a clear understanding of the type of video formats that are supported in order to develop applications that provide a seamless delivery of the media without any display issues.

The constraints of the processor speeds of handsets and the limitations of the mobile device networks can be challenging, but with perseverance it is possible to deliver and control video playback on devices. In this section I'll describe the different types of video formats,

Video formats

There are two major types of video formats used in media for Flash Lite applications:

  • Device
  • Native

Device video

Device videos are categorized as the type of video format that are decoded by the device itself. In this situation, Flash Lite player leverages the device's APIs to decode and playback (render) the video on the handset screen. A device video cannot be streamed; it must first be downloaded before playing.

The reason device videos cannot be streamed has to do with the decoding process. The run time executable (Flash Lite application) does not understand the video format and therefore it can only load a local video as a complete chunk and play it back (without returning the progress, duration and other metadata information). Flash Lite player can communicate to the platform, and this communication allows the information regarding the area where the platform should play the video to be passed to the device. At this point, the device platform renders the video.

The decoding process for device video is also the reason why it is not possible to overlay any other element on top of the device video in the mobile application. Device video always remains in front when displayed on the screen.

The following list of device video and audio codecs are supported by Symbian Mobile Platform:

Video Codecs:

  • H.263
  • PO L10
  • MPEG-4
  • Real Video (7, 8, 9 and 10)

Audio Codecs:

  • AMR-NB
  • Real Audio 7,8,10
  • AAC
  • AAC+

Note: These are not all-inclusive lists.

Native Video

Native videos are categorized as the types of video formats that are decoded by Flash Lite player and are then rendered on the handset screen. Since Flash Lite player is responsible for the decoding, you have the opportunity to use ActionScript to control how the video plays.

The following list of native video formats are supported by Flash Lite 3.x:

  • On2 (TrueMotion VP6)
  • Sorenson Spark (Sorenson Video Quantizer)

Note: The list of supported native video formats will vary depending on the specific platforms and versions of Flash Lite player you use to develop your project.

Supported RTMP (Real Time Messaging Protocol) video formats

Of all the different flavors of RTMP video, Flash Lite 3.x only supports the standard RTMP (Real Time Messaging Protocol) video format; other variants are not supported:

  • RTMP - Supported
  • RTMPT - Not supported
  • RTMPS - Not supported
  • RTMPE - Not supported
  • RTMPTE - Not supported
  • RTMFP - Not supported

In the next section, I'll describe a strategy you can use to control the soundtrack of a native video that is streaming in a Flash Lite 3.x mobile application.

Controlling the volume of video during playback

When I first began researching the information covered in this article, the forum post that triggered my interest asked if it was possible to control the volume of the video displayed in a mobile application built with Flash Lite 2.x.

After investigating, I determined that unfortunately it is not possible. Flash Lite 2.0 only supports embedded videos—and to be more specific, it only supports embedded device videos.

Flash Lite 2.0 uses the device's APIs to render embedded video on the screen of the handset, which means the APIs of the device are not exposed to ActionScript to allow you to control the parameters of the playback.

I continued to look for a way that sound control of the video could be achieved, and eventually developed the workaround presented below that allows you to use Flash Lite 3.0 to achieve this goal.

Using Flash Lite 3.0 to control the volume of native video

In the following section, I'll describe how to implement volume control in a mobile application with Flash Lite 3.0. To be clear, for this strategy to work it is important to only use native videos that are streaming (either locally or over the network). Since this code will be controlling streaming videos, it takes advantage of both the NetStream and NetConnection classes.

A description of the general implementation of video playback scripts is outside the scope of this article. The information provided here focuses on the workaround involved in controlling the volume of a video by attaching the audio from the NetStream to a movie clip.

The code example below contains the script for loading and streaming a video from an HTTP location. This article assumes that this code exists in your project already:

// DECLARING NetConnection AND NetStream VARIABLES var video_nc:NetConnection = new NetConnection(); video_nc.connect(null); var video_ns:NetStream = new NetStream(nc); // HANDLING THE STATUS OF NetStream ns.onStatus = function(info) { if (info.code == "NetStream.Play.Start") { // PLAYBACK STARTED } if (info.code == "NetStream.Play.Stop") { // PLAYBACK STOPPED } if(info.code == "NetStream.Buffer.Full") { // BUFFER FULL } if(info.code == "NetStream.Buffer.Empty") { // BUFFER EMPTY } }; // HANDLING THE METADATA OF THE NetStream ns.onMetaData = function(info) { // METADATA OF THE VIDEO }; // ATTACHING THE NETSTREAM TO THE VIDEO OBJECT ON STAGE video_vid.attachVideo(ns); // PLAY THE STREAM ns.play("http://www.mysite.com/video.flv");

In the code shown above, NetConnection and NetStream variables are declared to enable the video streaming.

To set this up, you need to place a Video object on the Stage. Right-click (Windows) or Control-click (Mac) on the Library and select "New Video..." from the Library Panel menu. Drag the new video symbol to the Stage, and while it is still selected, use the Property inspector to assign the following instance name: video_vid.

This next part is the workaround that you can use to control the volume of the sound of video. Since NetStream does not support the ability to adjust the volume directly, you can follow the steps outlined below to achieve this goal:

  1. Create a new empty movie clip.
  2. Attach the audio from the NetStream to the movie clip created in Step 1.
  3. Create a new Sound object for the newly created movie clip that has the audio attached from NetStream.
  4. Use ActionScript to control the volume of the Sound object.

Use the following code to set the volume of the Sound object:

this.createEmptyMovieClip("videoSound_mc",2) videoSound_mc.attachAudio(ns); video_snd = new Sound(videoSound_mc); video_snd.setVolume(75);

Choose Control > Test Movie to check it out (and make sure your speakers are turned on). After adding these changes, the soundtrack of the video in your project should play back at 75% of the original volume.

Where to go from here

To extend this code and make further adjustments to control the audio, you can work with the the last statement in the example above that calls the setVolume method. You can use this in your functions to implement slider volume control components, volume control components (buttons), text, and any other sound-related features that you'd like. Now that the Sound object can be manipulated, you can take advantage of ActionScript to add the controls you need for your mobile application.

To learn more about how to extend this code, see the online help for Developing Adobe Flash Lite 3.x Applications to see ActionScript examples. Specifically, check out the section titled Working with Video.

And be sure to visit both the Flash Developer Center and the Mobile and Devices Developer center to get helpful articles and sample projects to take your projects to the next level.

More Like This

  • Delivering video for Flash Player on mobile devices
  • Research In Motion and Adobe Systems alliance
  • Building a List component in Flash Lite
  • Design tips for creating mobile RIAs
  • Taking your brand mobile
  • Developing games for Nokia S60 Touch devices
  • Protecting Flash Lite content packaged in a Symbian installer with OMA DRM 1.0 Forward Lock
  • Mobile workflow in Adobe CS4
  • Flash Lite 3 video capabilities
  • Ten tips to help you develop better Flash Lite games

Products

  • Creative Suite
  • Photoshop Family
  • Acrobat Family
  • Flash Platform
  • Digital Marketing Suite
  • Digital Publishing Suite
  • Mobile apps

Solutions

  • Digital marketing
  • Digital media
  • Web Experience Management

Industries

  • Education
  • Financial services
  • Government

Help

  • Product help centers
  • Orders and returns
  • Downloading and installing
  • My Adobe

Learning

  • Adobe Developer Connection
  • Adobe TV
  • Training and certification
  • Forums
  • Design Center

Ways to buy

  • Adobe Store
  • For students and educators
  • For small and medium businesses
  • For enterprises
  • Special offers

Downloads

  • Adobe Reader
  • Adobe Flash Player
  • Adobe AIR
  • Adobe Shockwave Player

Company

  • News room
  • Partner programs
  • Corporate social responsibility
  • Career opportunities
  • Investor Relations
  • Events
  • Legal
  • 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
  • Pacific - English
  • 台灣

Southeast Asia

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

Copyright © 2012 Adobe Systems Incorporated. All rights reserved.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy (updated 07-14-2009).

Ad Choices

Reviewed by TRUSTe: site privacy statement