如何在没有任何第三方库的情况下在 Android 上制作 RTSP 客户端?

How to make RTSP Client on Android without any third party library?

刚刚查看了 Whosebug 问题 post link RTSP Client Implementation on Android

找到另一个 Android RTSP Client

尝试使用 videoview 和 surfaceview 来实现。

--http web link video is coming. 
--http using VLC player no video
--rtsp using VLC player no video.

我正在使用来自 Android RTSP 客户端

的代码
package com.weeklybuild.rtspviewer;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

import android.net.Uri;
import android.widget.MediaController;
import android.widget.VideoView;

public class MainActivity extends Activity {

@Override
  public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);

  String uri = "rtsp://localhost:8554/test";  //giving Url as per VLC 
  VideoView v = (VideoView) findViewById( R.id.videoView );
  v.setVideoURI( Uri.parse(uri) );
  v.setMediaController( new MediaController( this ) );
  v.requestFocus();
  v.start();
 }
}

谁能告诉我为什么无法使用 RTSP 观看视频?

我猜原因是指定的URI不正确。自 link、

rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov

有效,我们可以确定代码可以正常工作。我猜问题是因为问题中提供的 URI 没有编解码器。

您提供的第二个 link,Android RTSP Client 还指出编解码器可能存在很多问题。 (第 4 节中 link)

我建议添加 .stream 并检查。如果这不起作用,请尝试不同的编解码器。