版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、<p> 外文翻譯 中文+英文 14頁2651字數(shù)</p><p><b> 外文文獻:</b></p><p> Develop Rich Multimedia Apps with J2ME</p><p> The portability of J2ME across platforms can be used to cr
2、eate multimedia apps that take full advantage of the blistering connectivity speeds provided by 3G networks.</p><p> Tuesday, March 03, 2009</p><p> Sun Microsystems claims that Java ME is the
3、 most 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
4、 for today's multimedia and web enabled mobile handsets. Some of the useful libraries/APIs provided by the Java ME platform are:</p><p> Wireless Messaging API </p><p> Mobile Media API &l
5、t;/p><p> JAXP XML Parser </p><p> Location API </p><p> Mobile 3D Graphics </p><p> Payment API </p><p> In the article “Creating Apps for Mobiles”, pub
6、lished in PCQ Jan'09, we explored the J2ME development tools to create a simple application. We will continue the exploration by creating a tiny video player using the Mobile Media API。</p><p> Mobile M
7、edia API (JSR 135)</p><p> 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 vi
8、deo) and Camera (if available).</p><p> The package name for the Mobile Media API is:</p><p> "javax.microedition.media".</p><p> The building blocks of the system cons
9、ist 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 status and properties of the Players. Th
10、e 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.</p><p> Create a
11、 tiny video player application</p><p> In this article we will go through the steps of creating a project using the Mobile Media API and then develop the code required to create the player. Please refer to
12、the PCQ Jan '09 issue (also available online at pcquest.com) for the procedure to install the tools. You can test this application on the Emulator, but to use it on a mobile device, you will need a data connection su
13、ch as GPRS or the blazing fast 3G.</p><p> We will start by creating a project with the following details:</p><p> The toolkit will create the project and show the paths where you have to crea
14、te the source files.</p><p> Creating the source file for PCQ_Player Application</p><p> We now write the code to provide the desired functionality to your application:</p><p> p
15、ackage com.j2me.part1;</p><p> import javax.microedition.lcdui.*;</p><p> import javax.microedition.midlet.MIDlet;</p><p> import javax.microedition.media.*;</p><p>
16、 import javax.microedition.media.control.*;</p><p> public class PCQ_Player extends MIDlet implements</p><p> CommandListener {</p><p> private Display display;</p><p
17、> private Form form;</p><p> VideoPlayer vPlayer;</p><p> public PCQ_Player() </p><p><b> {</b></p><p> display = Display.getDisplay(this);</p>
18、;<p> form = new Form("PCQ Player");</p><p><b> }</b></p><p> public void startApp() {</p><p> form.addCommand( new Command( "Exit", Comma
19、nd.EXIT, 1 ));</p><p> form.setCommandListener(this);</p><p> vPlayer = new VideoPlayer(display, form, "http://createapoll.net/guest/R1.mpg");</p><p> Thread runner = n
20、ew Thread(vPlayer);</p><p> runner.start();</p><p><b> }</b></p><p> public void pauseApp() {</p><p><b> }</b></p><p> public
21、void destroyApp(boolean unconditional) {</p><p><b> }</b></p><p> public void commandAction(Command command, Displayable disp) </p><p><b> {</b></p>
22、<p> vPlayer.playerClose();</p><p> destroyApp(true);</p><p> notifyDestroyed();</p><p><b> }</b></p><p><b> }</b></p><p&
23、gt; class VideoPlayer implements Runnable, PlayerListener</p><p><b> {</b></p><p> Form form;</p><p> Player player;</p><p> Display display;</p>
24、<p> String url;</p><p> public VideoPlayer(Display display, Form form, String url)</p><p><b> {</b></p><p> this.display = display;</p><p> thi
25、s.form = form;</p><p> this.url = url;</p><p><b> }</b></p><p> public void run() {</p><p><b> try {</b></p><p> Alert alert =
26、 new Alert("Buffering ..."); //Download takes time</p><p> alert.setTimeout(Alert.FOREVER); //so display message</p><p> display.setCurrent(alert);</p><p> player = Man
27、ager.createPlayer(url);</p><p> player.addPlayerListener(this);</p><p> player.setLoopCount(1); </p><p> //Play only once</p><p> player.start(); // Start the playb
28、ack</p><p> display.setCurrent(form);</p><p><b> } </b></p><p> catch(Exception e)</p><p><b> { </b></p><p> Alert alert = new
29、 Alert("Failed to play video"); //Display message in case</p><p> alert.setTimeout(Alert.FOREVER); //there is an error</p><p> display.setCurrent(alert);</p><p><b>
30、; }</b></p><p><b> }</b></p><p> public void playerUpdate(Player player, String event, Object eventData)</p><p><b> {</b></p><p> if(
31、event.equals(PlayerListener.STARTED)</p><p><b> )</b></p><p><b> {</b></p><p> videoControl vControl = (VideoControl) player.getControl("VideoControl
32、");</p><p> form.append((Item)v Control.initDisplayMode(vControl.USE_GUI_PRIMITIVE, null));</p><p> } else if(event.equals(PlayerListener.CLOSED))</p><p><b> {</b&g
33、t;</p><p> form.deleteAll(); </p><p><b> }</b></p><p><b> }</b></p><p> public void playerClose() {</p><p> player.close(); //
34、 close playback</p><p><b> }</b></p><p><b> }</b></p><p> Copy the above source code in Notepad and save this as PCQ_Player.java in the fully qualified so
35、urce path, which is the path you copied in the previous step plus 'com\j2me\part1'. In my case the path is</p><p> D:\Users\Sudipto Chanda\ j2mewtk\ 2.5.2\ apps\PCQ_Player\src\ com\j2me\ part1.</
36、p><p> Important: Make sure that you select 'All Files', while saving from Notepad, otherwise, Notepad may append a '.txt' extension. It is a good idea to verify the file name to be PCQ_Player.
37、java.</p><p> The source given in this article is very minimal without much error handling. The documentation provided with WTK (usually located in C:\WTK2.5.2\docs\ api\midp) contains more detailed guideli
38、nes of using the Mobile Media API and other packages of J2ME.</p><p> Executing the PCQ_Player</p><p> Use the Build option to compile and build the player source. Then you need to click on Ru
39、n to execute the code in the Emulator. Next click on the button that is located below 'Launch' to start the PCQ_Player application.</p><p> The Emulator will present you with the question “Is it OK
40、to Use Airtime?” You need to click on the button below 'Yes' to continue. This option is valuable in mobile phones as service providers will charge you for data downloads. You might need to be patient though, as
41、your video will take a while to come up, depending on your computer and Internet speed.</p><p> The PCQ_Player application plays the content from the URL:</p><p> "http://createapoll. net
42、/guest/R1.mpg".</p><p> Now, you can upload content to any website where you have access. However, the content should be converted for the size and capability of the device. Files with MPEG1/MPEG2 vide
43、o with MP3 audio in QVGA or QCIF sizes usually work fine with this application.</p><p> Conclusion</p><p> As you have seen, J2ME can be used to create professional quality applications for ri
44、ch multimedia and graphics experience. You can also extend this functionality to create robust enterprise class applications for banking and finance.</p><p> These days you see a lot of banks and financial
45、institutions giving importance to the mobile banking platform. With millions of mobile devices being sold around the world that support the Java ME platform, along with the spread of Internet connection for mobile device
46、s such as GPRS, Edge and the blazingly fast 3G and WiMAX just round the corner, the possibilities for developers providing apps for these platforms are immense.</p><p> The core advantage of Java ME-which i
47、s portability across platforms (such as Windows Mobile, Symbian, Linux etc.) makes it a winner in the diverse jungle of embedded systems.</p><p><b> 譯文:</b></p><p> 開發(fā)豐富的多媒體應用與J2ME
48、</p><p> J2ME的跨平臺的可移植性,可用于創(chuàng)建多媒體應用程序,可以利用起泡連通3G網(wǎng)絡提供的速度充分利用。</p><p> 星期二,2009年3月3日</p><p> Sun公司稱,Java ME是部署于超過一億套移動設備的最普遍的應用平臺。除了在便攜設備以及強大的安全性很大的優(yōu)勢,Java ME還為現(xiàn)在具備多媒體和網(wǎng)絡功能的移動手機提供了豐富
49、的API集。由Java ME平臺提供的有用的庫和API集有:</p><p><b> ?無線消息API</b></p><p><b> ?移動媒體API</b></p><p> ?JAXP的XML解析器</p><p><b> ?位置API</b></p&
50、gt;<p><b> ?手機3D圖形</b></p><p><b> ?支付API</b></p><p> 在文章“創(chuàng)建用于手機應用程序”發(fā)表于一月九日的PCQ后,我們探討了J2ME開發(fā)工具來創(chuàng)建一個簡單的應用。我們將繼續(xù)創(chuàng)造一個微小的視頻播放器使用移動媒體API的探索。</p><p> 移動
51、媒體API(符合JSR 135)</p><p> 移動媒體API提供了一個接口上運行的J2ME的移動設備的多媒體功能。這包括揚聲器(或耳機),麥克風,液晶顯示屏(視頻)和攝像機(如果有的話)。</p><p> 為移動媒體API的包名是:</p><p> “javax.microedition.media”。</p><p> 該
52、系統(tǒng)的組成部分包括管理者、播放器和控制。管理者是頂級的多媒體資源控制器。J2ME應用程序使用管理器來創(chuàng)建和管理播放器和查詢狀態(tài)和Player的屬性。Player真正發(fā)揮多媒體內容??刂平涌谑怯脕韺崿F(xiàn)不同的控制一個Player可能有諸如VolumeControl來增加/降低音量。</p><p> 創(chuàng)建一個小的視頻播放器應用程序</p><p> 在這篇文章中我們將通過創(chuàng)建一個項目使用的
53、移動媒體API的步驟,然后發(fā)展需要創(chuàng)建的播放器代碼。安裝的程序的工具時請參閱1月9日的PCQ(也可在網(wǎng)上查詢pcquest.com)。你可以在模擬器上測試這個應用,而如果讓它在移動設備上運行,您將需要諸如GPRS或高速3G的數(shù)據(jù)連接。</p><p> 我們將首先創(chuàng)建一個具有以下詳細項目:</p><p> 該工具包將創(chuàng)建項目并顯示的路徑,你必須創(chuàng)建源文件。</p>&l
54、t;p> 創(chuàng)建應用程序源文件的PCQ_Player</p><p> 現(xiàn)在,我們編寫代碼來為您的應用程序提供所需的功能:</p><p> package com.j2me.part1;</p><p> import javax.microedition.lcdui.*;</p><p> import javax.micr
55、oedition.midlet.MIDlet;</p><p> import javax.microedition.media.*;</p><p> import javax.microedition.media.control.*;</p><p> public class PCQ_Player extends MIDlet implements<
56、;/p><p> CommandListener {</p><p> private Display display;</p><p> private Form form;</p><p> VideoPlayer vPlayer;</p><p> public PCQ_Player() </p>
57、;<p><b> {</b></p><p> display = Display.getDisplay(this);</p><p> form = new Form("PCQ Player");</p><p><b> }</b></p><p>
58、 public void startApp() {</p><p> form.addCommand( new Command( "Exit", Command.EXIT, 1 ));</p><p> form.setCommandListener(this);</p><p> vPlayer = new VideoPlayer(dis
59、play, form, "http://createapoll.net/guest/R1.mpg");</p><p> Thread runner = new Thread(vPlayer);</p><p> runner.start();</p><p><b> }</b></p><p&g
60、t; public void pauseApp() {</p><p><b> }</b></p><p> public void destroyApp(boolean unconditional) {</p><p><b> }</b></p><p> public void c
61、ommandAction(Command command, Displayable disp) </p><p><b> {</b></p><p> vPlayer.playerClose();</p><p> destroyApp(true);</p><p> notifyDestroyed();<
62、;/p><p><b> }</b></p><p><b> }</b></p><p> class VideoPlayer implements Runnable, PlayerListener</p><p><b> {</b></p><p&
63、gt; Form form;</p><p> Player player;</p><p> Display display;</p><p> String url;</p><p> public VideoPlayer(Display display, Form form, String url)</p>&l
64、t;p><b> {</b></p><p> this.display = display;</p><p> this.form = form;</p><p> this.url = url;</p><p><b> }</b></p><p> p
65、ublic void run() {</p><p><b> try {</b></p><p> Alert alert = new Alert("Buffering ..."); //Download takes time</p><p> alert.setTimeout(Alert.FOREVER); //s
66、o display message</p><p> display.setCurrent(alert);</p><p> player = Manager.createPlayer(url);</p><p> player.addPlayerListener(this);</p><p> player.setLoopCount
67、(1); </p><p> //Play only once</p><p> player.start(); // Start the playback</p><p> display.setCurrent(form);</p><p><b> } </b></p><p> c
68、atch(Exception e)</p><p><b> { </b></p><p> Alert alert = new Alert("Failed to play video"); //Display message in case</p><p> alert.setTimeout(Alert.FOREVE
69、R); //there is an error</p><p> display.setCurrent(alert);</p><p><b> }</b></p><p><b> }</b></p><p> public void playerUpdate(Player player,
70、 String event, Object eventData)</p><p><b> {</b></p><p> if(event.equals(PlayerListener.STARTED)</p><p><b> )</b></p><p><b> {</b&
71、gt;</p><p> videoControl vControl = (VideoControl) player.getControl("VideoControl");</p><p> form.append((Item)v Control.initDisplayMode(vControl.USE_GUI_PRIMITIVE, null));</p>
72、;<p> } else if(event.equals(PlayerListener.CLOSED))</p><p><b> {</b></p><p> form.deleteAll(); </p><p><b> }</b></p><p><b> }
73、</b></p><p> public void playerClose() {</p><p> player.close(); // close playback</p><p><b> }</b></p><p><b> }</b></p><p&
74、gt; 在記事本中復制上面的源代碼,并保存完整的源代碼到PCQ_Player.java這一位置,并在你在上一步復制的路徑加上使用“com\j2me\part1”。在我的情況下,路徑是:</p><p> D:\Users\Sudipto Chanda\ j2mewtk\ 2.5.2\ apps\PCQ_Player\src\ com\j2me\ part1.</p><p> 重要事
75、項:請確保您選擇'所有文件',而從記事本保存,否則,記事本可能追加擴展名'txt '。這是一個好辦法來驗證名稱為PCQ_Player.java的文件。</p><p> 在這篇文章中給出的源文件是最小的且沒有太多的錯誤處理。與WTK中提供的文件(通常位于C:\WTK2.5.2\docs\ api\midp)包含使用移動媒體API和J2ME的其他包具有更詳盡的指引。</p&g
76、t;<p> 執(zhí)行PCQ_Player</p><p> 使用構建選項來編譯和構建的Player來源。然后你需要點擊運行以執(zhí)行在模擬器的代碼。下一步點擊按鈕位于下方是'啟動'開始PCQ_Player應用。</p><p> 模擬器將會對你提出問題“是否可以使用通話時間?”,你需要點擊下面的'是'按鈕來繼續(xù)。這個選項是在移動電話服務供應商向
77、你提供付費文件下載時所需要的。您可能需要耐心等待一段時間,因為您的視頻將需要一段時間才能上傳到,這取決于您的計算機和互聯(lián)網(wǎng)的速度。</p><p> 該PCQ_Player應用程序播放URL中的內容:</p><p> “http://createapoll.net/guest/R1.mpg”。</p><p> 現(xiàn)在,你可以向你可以訪問的網(wǎng)站上傳文件。然而,
78、內容要轉換的規(guī)模和設備的能力有關。MPEG1/MPEG2的視頻文件和QVGA/QCIF類型的MP3音頻文件通??捎么藨贸绦蜉^好地播放。</p><p><b> 結論</b></p><p> 正如你所看到的,J2ME可以用于創(chuàng)建豐富的多媒體和進行專業(yè)的圖形開發(fā)應用。你還可以擴展此功能來創(chuàng)建功能強大的銀行和金融類的應用程序。</p><p&g
79、t; 現(xiàn)在,你所看到的銀行很多都對移動銀行業(yè)務給予較高的重視。隨著數(shù)百萬支持Java ME平臺的移動設備在世界各地的普及,隨著互聯(lián)網(wǎng)如GPRS,高速3G和WiMAX移動設備的連接以及傳播銷售指日可待,這些平臺對于開發(fā)商提供的應用程序具有巨大的可能性。</p><p> Java ME的核心優(yōu)勢,就是跨平臺的可攜性(例如Windows Mobile,Symbian和Linux的等),這將使其成為在多樣化的嵌入式
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 眾賞文庫僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 基于j2me開發(fā)工具下的多媒體【文獻綜述】
- 基于J2ME的手機多媒體應用解決方案的研究與實現(xiàn).pdf
- j2me畢業(yè)論文-- j2me手機彩票軟件開發(fā)
- j2me手機游戲的開發(fā)-beckhamgoal
- 基于J2ME的移動應用系統(tǒng)的研究與開發(fā).pdf
- J2ME多媒體手機閱讀器的設計實現(xiàn)與改進分析.pdf
- 基于j2me平臺的手機游戲開發(fā)
- 基于j2me平臺的手機游戲開發(fā)
- 計算機外文翻譯---j2me和java領域
- 基于j2me平臺的手機應用開發(fā)-畢業(yè)論文
- 畢業(yè)論文——基于gprs網(wǎng)絡的j2me應用開發(fā)
- 基于J2ME的手機應用軟件的研究與開發(fā).pdf
- 基于J2ME的嵌入式系統(tǒng)應用開發(fā)與研究.pdf
- 基于J2ME平臺的手機應用程序研究與開發(fā).pdf
- 基于J2ME的手機游戲開發(fā)與實現(xiàn).pdf
- 基于J2ME的手機銀行應用系統(tǒng)的開發(fā)與設計.pdf
- 基于j2me平臺的手機應用開發(fā)-畢業(yè)論文
- 基于J2ME的手機游戲設計開發(fā).pdf
- 基于J2ME的手機游戲開發(fā)定稿.doc
- 基于J2ME的手機游戲的開發(fā)與設計.pdf
評論
0/150
提交評論