国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

使用索愛V800開發流媒體應用程序

2019-11-18 14:45:34
字體:
來源:轉載
供稿:網友

        索尼愛立信的V800手機可以支持流媒體的播放,使用非常簡單。假如你曾經使用MMAPI播放過聲音或者做過照相應用的話,那么上手非常快。

        你要做的就是根據指定的URL來創建一個Player,然后啟動這個Player。URL的格式如下:rtsp://MyServer/myVideo.3gp。下面的代碼例子演示了如何使用:
PRivate void startStreaming(){
        try{
             myPlayer = Manager.createPlayer("rtsp://MyServer/MyFile.3gp");
             myPlayer.addPlayerListener(this);
             myPlayer.realize();
              // Grab the video control and set it to the current display.
              vc = (VideoControl)myPlayer.getControl("VideoControl");
              if (vc != null) {
                myForm.append((Item)vc.initDisplayMode(vc.USE_GUI_PRIMITIVE, null));
                // sets the display size of the video.
                vc.setDisplaySize(120,160); 
              }         
              myPlayer.start();

         }catch(Exception e){
                log("Exception: " + e.toString());
         }

    }
        我們需要注重的是進行連接服務器的時候必須在單獨線程中處理,而不能在主線程。因為這樣會堵塞系統。接下來你要做的就是構建一個支持RTSP的流媒體服務器,放置一個3gp格式的文件在服務器上。下面的代碼演示了如何使用V800開發流媒體應用。
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
import javax.microedition.media.*;
import javax.microedition.media.control.*;
import java.io.*;
import javax.microedition.lcdui.game.*;


/**
 * A simple example of the MMAPI (JSR 135) support for Streaming Video
 * with the Sony EriCSSon V800.
 *
 * This code is part of the Tips & Tricks section at
 * www.SonyEricsson.com/developer
 *
 * COPYRIGHT All rights reserved Sony Ericsson Mobile Communications AB 2005.
 * The software is the copyrighted work of Sony Ericsson Mobile Communications AB.
 * The use of the software is subject to the terms of the end-user license
 * agreement which accompanies or is included with the software. The software is
 * provided "as is" and Sony Ericsson specifically disclaim any warranty or
 * condition whatsoever regarding merchantability or fitness for a specific
 * purpose, title or non-infringement. No warranty of any kind is made in
 * relation to the condition, suitability, availability, accuracy, reliability,
 * merchantability and/or non-infringement of the software provided herein.
 *
 * Written by Jöns Weimarck, January 2005
 */
public class StreamingVideo extends MIDlet implements CommandListener, PlayerListener, Runnable{
   
   
    private Display myDisplay;
    private Form myForm;
 
    private Thread streamingThread;
    private Player myPlayer;
    private VideoControl vc;
    private boolean running=false;
   
    public StreamingVideo() {
        myDisplay = Display.getDisplay(this);
        myForm=new Form ("Streaming Test");
        myForm.addCommand(new Command("Exit", Command.EXIT,0));
        myForm.addCommand(new Command("Start", Command.OK,0));
        myForm.setCommandListener(this);
    }
  



發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 安丘市| 保定市| 元江| 莱阳市| 阳原县| 唐河县| 新乐市| 邹平县| 三都| 忻州市| 古田县| 沛县| SHOW| 仁布县| 龙陵县| 龙南县| 高清| 龙口市| 潼南县| 新绛县| 普兰县| 武安市| 雷山县| 金堂县| 白朗县| 浦江县| 怀集县| 日土县| 会同县| 西畴县| 鹰潭市| 西城区| 平江县| 大方县| 乐山市| 滕州市| 英吉沙县| 浏阳市| 金阳县| 志丹县| 芒康县|