外文翻译--开发丰富的多媒体应用与J2ME.doc

上传人:壹****1 文档编号:510271357 上传时间:2023-02-14 格式:DOC 页数:14 大小:77KB
返回 下载 相关 举报
外文翻译--开发丰富的多媒体应用与J2ME.doc_第1页
第1页 / 共14页
外文翻译--开发丰富的多媒体应用与J2ME.doc_第2页
第2页 / 共14页
外文翻译--开发丰富的多媒体应用与J2ME.doc_第3页
第3页 / 共14页
外文翻译--开发丰富的多媒体应用与J2ME.doc_第4页
第4页 / 共14页
外文翻译--开发丰富的多媒体应用与J2ME.doc_第5页
第5页 / 共14页
点击查看更多>>
资源描述

《外文翻译--开发丰富的多媒体应用与J2ME.doc》由会员分享,可在线阅读,更多相关《外文翻译--开发丰富的多媒体应用与J2ME.doc(14页珍藏版)》请在金锄头文库上搜索。

1、外文翻译 中文+英文 14页2651字数外文文献:Develop Rich Multimedia Apps with J2METhe portability of J2ME across platforms can be used to create multimedia apps that take full advantage of the blistering connectivity speeds provided by 3G networks.Tuesday, March 03, 2009Sun Microsystems claims that Java ME is the most

2、 ubiquitous application platform for mobile devices, deployed on more than a billion sets. Apart from the great advantage of portability across devices along with robust security, Java ME provides a rich set of APIs for todays multimedia and web enabled mobile handsets. Some of the useful libraries/

3、APIs provided by the Java ME platform are: Wireless Messaging API Mobile Media API JAXP XML Parser Location API Mobile 3D Graphics Payment API In the article “Creating Apps for Mobiles”, published in PCQ Jan09, we explored the J2ME development tools to create a simple application. We will continue t

4、he exploration by creating a tiny video player using the Mobile Media API。Mobile Media API (JSR 135)The Mobile Media API provides an interface to the multimedia capabilities of the mobile device running J2ME. This includes the speaker (or headset), microphone, LCD Screen (for video) and Camera (if a

5、vailable).The package name for the Mobile Media API is:javax.microedition.media.The building blocks of the system consist of -Manager, Player and Control. The Manager is the top level controller for the multimedia resources. J2ME applications use the Manager to create and manage Players and query st

6、atus and properties of the Players. The Players actually play the multimedia content. The Control interface is used to implement the different controls a Player might have, such as VolumeControl to increase/decrease the volume.Create a tiny video player applicationIn this article we will go through

7、the steps of creating a project using the Mobile Media API and then develop the code required to create the player. Please refer to the PCQ Jan 09 issue (also available online at ) for the procedure to install the tools. You can test this application on the Emulator, but to use it on a mobile device

8、, you will need a data connection such as GPRS or the blazing fast 3G.We will start by creating a project with the following details:The toolkit will create the project and show the paths where you have to create the source files.Creating the source file for PCQ_Player ApplicationWe now write the co

9、de to provide the desired functionality to your application:package com.j2me.part1;import javax.microedition.lcdui.*;import javax.microedition.midlet.MIDlet;import javax.microedition.media.*;import javax.microedition.media.control.*;public class PCQ_Player extends MIDlet implementsCommandListener pr

10、ivate Display display;private Form form;VideoPlayer vPlayer;public PCQ_Player() display = Display.getDisplay(this);form = new Form(PCQ Player);public void startApp() form.addCommand( new Command( Exit, Command.EXIT, 1 );form.setCommandListener(this);vPlayer = new VideoPlayer(display, form, http:/ ru

11、nner = new Thread(vPlayer);runner.start();public void pauseApp() public void destroyApp(boolean unconditional) public void commandAction(Command command, Displayable disp) vPlayer.playerClose();destroyApp(true);notifyDestroyed();class VideoPlayer implements Runnable, PlayerListenerForm form;Player p

12、layer;Display display;String url;public VideoPlayer(Display display, Form form, String url)this.display = display;this.form = form;this.url = url;public void run() try Alert alert = new Alert(Buffering .); /Download takes timealert.setTimeout(Alert.FOREVER); /so display messagedisplay.setCurrent(ale

13、rt);player = Manager.createPlayer(url);player.addPlayerListener(this);player.setLoopCount(1); /Play only onceplayer.start(); / Start the playbackdisplay.setCurrent(form); catch(Exception e) Alert alert = new Alert(Failed to play video); /Display message in casealert.setTimeout(Alert.FOREVER); /there

14、 is an errordisplay.setCurrent(alert);public void playerUpdate(Player player, String event, Object eventData)if(event.equals(PlayerListener.STARTED)videoControl vControl = (VideoControl) player.getControl(VideoControl);form.append(Item)v Control.initDisplayMode(vControl.USE_GUI_PRIMITIVE, null); els

15、e if(event.equals(PlayerListener.CLOSED)form.deleteAll(); public void playerClose() player.close(); / close playbackCopy the above source code in Notepad and save this as PCQ_Player.java in the fully qualified source path, which is the path you copied in the previous step plus comj2mepart1. In my case the path isD:UsersSudipto Chanda j2mewtk 2.5.2 appsPCQ_Playersrc comj2me part1.Important: Make sure that you select Al

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 行业资料 > 农业工程

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号