Adobe
产品

首选目的地

  • Creative Suite
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • SiteCatalyst

教育

  • 适用于学生
  • 适用于中小学
  • 适用于高等教育机构

设计和照片

  • Photoshop
  • Illustrator
  • InDesign
  • Lightroom
  • Elements 系列

视频

  • Adobe Premiere
  • After Effects

Web 开发和 HTML5

  • Dreamweaver
  • 游戏 [在新窗口中打开]
  • 移动应用程序

Adobe Marketing Cloud

  • 什么是 Adobe Marketing Cloud?
  • 数字分析
  • Web 体验管理
  • 测试和目标定位

分析

  • SiteCatalyst
  • Adobe Discover
  • Insight

Experience Manager

  • CQ

目标

  • Test&Target
  • Recommendations
  • Search&Promote

媒体优化工具

  • AudienceManager
  • AudienceResearch

文档服务

  • Acrobat
  • SendNow [在新窗口中打开]

出版

  • Digital Publishing Suite

  • 查看所有产品
业务解决方案

按业务需求分

  • 数字分析
  • 数字出版
  • 文档管理
  • 测试和目标定位
  • 视频编缉和服务
  • Web 开发 [在新窗口中打开]
  • Web 体验管理
  • 查看所有业务需求

按行业分

  • 广播
  • 教育
  • 金融服务业
  • 政府部门
  • 出版
  • 零售业
  • 查看所有行业
支持和培训

我需要帮助

  • 产品
  • Adobe Marketing Cloud
  • 论坛 [在新窗口打开]

我想学习

  • 培训和教程
  • 证书 [在新窗口打开]
  • Adobe 开发人员连接
  • Adobe 设计中心
  • Adobe TV [在新窗口打开]
  • Adobe 市场营销中心
  • Adobe Labs [在新窗口中打开]
下载
  • 产品试用
  • Adobe Flash Player
  • Adobe Reader
  • Adobe AIR
  • 查看所有下载
公司
  • Adobe 工作机会
  • 投资者关系
  • 新闻中心
  • 隐私
  • 公司社会责任
  • 客户展示
  • 联系我们
  • 更多公司信息
购买
  • 在线商店
  • 针对学生、教师和职员
  • 批量许可
  • 优惠酬宾
  • 寻找经销商
  • Adobe Marketing Cloud 销售 [在新窗口中打开]
搜索
 
信息 登录
为何登录?登录后可以管理您的帐户,访问试用版下载、产品扩展和社区区域等。
欢迎,
我的 Adobe
我的信息
我的首选项
注销
隐私权 我的 Adobe
Adobe
产品 分类 购买   搜索  
解决方案 公司
帮助 培训
登录 注销 隐私权 我的 Adobe
Date Date
Qty:
Subtotal
Promotions
Estimated Shipping
VAT
Calculated at checkout
Total
Checkout
Adobe 开发者中心 / 移动和设备开发人员中心 /

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

页面工具

在 LinkedIn 上共享
书签
打印

Tags

要求

必备知识

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

  • Building a List component in Flash Lite
  • Flash Lite 3 training video
  • How to protect Flash Lite content with OMA DRM 1.0
  • The RIM BlackBerry PlayBook difference
  • Enter the Adobe AIR App Challenge, Sponsored by Sony
  • 优化联网电视应用程序的性能
  • Flash sizing Zen: Making Flash fit on mobile devices
  • Remote mobile device testing with DeviceAnywhere
  • 与众不同的RIM BlackBerry PlayBook
  • 应用于Flash Player和AIR的简化移动视频编码建议

产品

  • Creative Suite
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • Digital Publishing Suite
  • Elements 系列
  • SiteCatalyst

下载

  • 产品试用
  • Adobe Reader
  • Adobe Flash Player
  • Adobe AIR

支持和培训

  • 产品帮助
  • 论坛

购买

  • 在线商店
  • 针对学生、教师和职员
  • 批量许可
  • 优惠酬宾
  • 寻找经销商

公司

  • 新闻中心
  • 合作伙伴计划
  • 公司社会责任
  • 工作机会
  • 投资者关系
  • 事件
  • 法律
  • 安全性
  • 联系 Adobe
选择您的地区 中国(更改)
选择您的地区 关闭

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 Software Ireland Ltd. All rights reserved.

使用条款 | 隐私权 | Cookies

京 ICP 备 10217899 号 京公网安备 110105010404