Adobe
製品
Acrobat
Creative Cloud
Creative Suite
Digital Marketing Suite
Digital Publishing Suite
Elements
Photoshop
Touch Apps
その他の製品一覧
ソリューション
デジタルマーケティング
デジタルメディア
教育
金融機関
Web Experience Management
その他のソリューション
ラーニング サポート ダウンロード 会社情報
ご購入
アドビストア 安心のサポート& サービス
アカデミックストア 学生、教職員、個人向け
アドビライセンスストア 中小企業向け
ボリュームライセンスについて 企業、教育機関、官公庁向け
販売パートナー
キャンペーン情報
検索
 
情報 サインイン
ようこそ、 さん カート 注文状況 マイアカウント
マイアカウント
注文状況
アカウント情報の変更
コミュニケーションの設定を変更
サインアウト
サインインの目的 お客様のアカウントや体験版ダウンロード、製品の拡張機能、コミュニティエリアへのアクセスなどを管理するため
Adobe
製品 セクション ご購入   検索  
ソリューション 会社情報
サポート ラーニング
サインイン サインアウト 注文状況 マイアカウント
先行予約の提供開始予定日Date. 商品が発送されるまで、クレジットカードには課金されません。提供開始の予定日は変更される場合があります。 先行予約の提供開始予定日Date. ダウンロードの準備が整うまで、クレジットカードには課金されません。提供開始の予定日は変更される場合があります。
個数:
ご購入には学生・教職員個人版の購入資格の確認が必要です。
小計
カートの中身を見る
Adobe Developer Connection / モバイル&デバイスデベロッパーセンター /

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

著者 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

ページ ツール

Facebookでシェア
Twitterでツイート
LinkedInでシェア
ブックマーク
印刷

タグ

必要条件

この記事に必要な予備知識

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

ユーザーレベル

すべて

必要な製品

  • 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

  • Designing for the RIM BlackBerry PlayBook
  • Optimizing performance of applications for connected TVs
  • How to protect Flash Lite content with OMA DRM 1.0
  • Creating video content for Flash Lite mobile devices
  • HTC Hero: The first Android device with Flash
  • Flash Lite 3 training video
  • Video encoding guidelines for Android mobile devices
  • Best practices for mobile device video player optimization
  • Designing and developing Flash games for the Sony PSP
  • Remote mobile device testing with DeviceAnywhere

製品

  • Acrobat
  • Creative Cloud
  • Creative Suite
  • Digital Marketing Suite
  • Digital Publishing Suite
  • Elements
  • モバイルアプリ
  • Photoshop
  • Touch Apps

ソリューション

  • デジタルマーケティング
  • コンテンツオーサリング
  • Web Experience Management

業種別ソリューション

  • 教育
  • 金融機関

サポート

  • ヘルプ&サポート
  • 注文と返品
  • ダウンロードに関するヘルプ
  • ユーザー登録に関するヘルプ

ラーニング

  • ADC: Adobe Developer Center
  • Adobe TV
  • Design Magazine
  • Photoshop Magazine
  • Focus In

ご購入方法

  • アドビストア
  • アカデミックストア
  • アドビライセンスストア
  • ボリュームライセンスについて
  • 販売パートナー
  • キャンペーン情報

ダウンロード

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

会社情報

  • プレスルーム
  • パートナープログラム
  • 企業の社会的責任(英語)
  • 採用情報
  • 投資家の皆様へ(英語)
  • イベント&セミナー
  • Legal(英語)
  • セキュリティ
  • お問い合わせ
国・地域および言語の選択 日本(変更)
国・地域および言語の選択 閉じる

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 © 2012 Adobe Systems Incorporated. All rights reserved.

利用条件 | プライバシーポリシーとCookie (更新)

Reviewed by TRUSTe: site privacy statement