最近准备着手研究下流媒体播放,苦于没有开放的支持rtsp协议的api
望各位大拿予以支持,将会万分感谢!....
如有经验者用其他的方法予以支持,
thank you all the same...

解决方案 »

  1.   

    看看这个
    http://topic.csdn.net/u/20091126/10/09ba4ba0-90fb-4cc2-9b0b-39112c33342b.html
      

  2.   

    自己写服务,自己实现,为什么非要用API那   
      

  3.   

    拿了网上的一段代码改了改,自己做了个。package com.arashmen.demo;import java.io.BufferedWriter;
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStreamWriter;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.net.URLConnection;import android.app.Activity;
    import android.media.MediaPlayer;
    import android.os.Bundle;
    import android.os.Handler;
    import android.util.Log;
    import android.view.View;
    import android.view.View.OnClickListener;
    import android.webkit.WebView;
    import android.widget.Button;public class MainActivity extends Activity {
    private WebView webView;
    private Button btn;
    private MediaPlayer mPlayer;

    private boolean downloadOver = false;    private boolean wasPlayed = false;

    private static final String TAG = "AudioPlayer";


    private String current;    private static final int MIN_BUFF = 100 * 1024;    private int totalKbRead = 0;    private Handler handler = new Handler();    private File DLTempFile;    private File BUFFTempFile;    private final String TEMP_DOWNLOAD_FILE_NAME = "tempMediaData";    private final String TEMP_BUFF_FILE_NAME = "tempBufferData";    private final String FILE_POSTFIX = ".dat";    private final int PER_READ = 1024;    private boolean pause;    private boolean stop;    private final int UNKNOWN_LENGTH = -1; private final String MUSIC_URL = "http://www.6e.cn/photo/2008/11/28/20081129105638220.mp3"; public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main); webView = (WebView) findViewById(R.id.swfWebv);
    webView.getSettings().setPluginsEnabled(true); mPlayer = new MediaPlayer(); btn = (Button) findViewById(R.id.Button01);
    btn.setOnClickListener(new OnClickListener() {
    public void onClick(View v) { PlayMusicOnline(MUSIC_URL, 0, UNKNOWN_LENGTH); }
    });
    }
        private void PlayMusicOnline(String mediaUrl, int start, int end) {              URLConnection cn = null;              FileOutputStream out = null;              InputStream is = null;              try {
                    /*打开连接*/
                           cn = new URL(mediaUrl).openConnection();
                           /*连接*/
                           cn.connect();
                           /*获得数据流*/
                           is = cn.getInputStream();
                           /*获得网络文件的总长度*/
                           int mediaLength = cn.getContentLength();                       if (is == null) {                                return;                       }                       /*创建临时文件*/
                           DLTempFile = new File("/sdcard/winter1.mp3");
                           /*创建文件输入流*/
                           out = new FileOutputStream(DLTempFile,true);
                           
                           /*创建字节数组*/
                           byte buf[] = new byte[PER_READ];                       int readLength = 0;
                           //
                           while (readLength != -1 && !stop) {                                if (pause) {                                          try {                                                   Thread.sleep(3000);                                          } catch (InterruptedException e) {                                                   e.printStackTrace();                                          }                                          continue;                                }
                                    /* 字节长度*/
                                    readLength = is.read(buf);
                                    
                                    if (readLength > 0) {                                          try {
                                                /* 向文件追加写入该段字节内容*/
                                                       out.write(buf, 0, readLength);
                                                       
                                                       /* 当前字节总长度,包括之前*/
                                                       totalKbRead += readLength;                                          } catch (Exception e) {
                                               
                                               e.printStackTrace();
                                               
                                              }                                }                       }                       if (totalKbRead == mediaLength) {                                downloadOver = true;//                                 删除临时文件
    //
    //                                if (DLTempFile != null && DLTempFile.exists()) {
    //
    //                                          DLTempFile.delete();
    //
    //                                }                       }              } catch (MalformedURLException e) {                       Log.e(TAG, e.toString());              } catch (IOException e) {                       Log.e(TAG, e.toString());              } finally {                       if (out != null) {                                try {                                          out.close();                                } catch (IOException e) {                                          e.printStackTrace();                                }                       }                       if (is != null) {                                try {                                          is.close();                                } catch (IOException e) {                                          e.printStackTrace();                                }                       }              }    }
    }
      

  4.   

    LS 干嘛呢  你这是http
      

  5.   


    对阿,只是用http去模拟那个rtsp的过程,我做过试验了可以行得通。实际上就是http