我有一个网络IP摄像头,通过RTSP提供H264流。 android上的https://play.google.com/store/apps/details?id=org.rtspplr.app&hl=en可以播放rtsp流。 Windows上的VLC可以显示此直播流。 但是当我尝试在我的Android应用程序中查看它说“无法播放此视频”时,我有以下代码:
.java文件
private VideoView myVideoView;
private MediaController myMediaControler;
private String url;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
url = "rtsp://192.168.5.108:554/rtpstream/config5=r";
myVideoView = (VideoView)findViewById(R.id.myVideoView);
myVideoView.setVideoPath(url);
myMediaControler = new MediaController(this);
myMediaControler.setAnchorView(myVideoView);
myVideoView.setMediaController(myMediaControler);
myVideoView.start();
myVideoView.requestFocus();
控制台输出
01-11 16:47:29.754 2564-2576/com.example.sahmed.hdvrlitelivetest1 W/MediaPlayer: info/warning (701, 0)
01-11 16:47:40.445 2564-2576/com.example.sahmed.hdvrlitelivetest1 E/MediaPlayer: error (1, -2147483648)
01-11 16:47:40.446 2564-2564/com.example.sahmed.hdvrlitelivetest1 E/MediaPlayer: Error (1,-2147483648)
01-11 16:47:40.447 2564-2564/com.example.sahmed.hdvrlitelivetest1 D/VideoView: Error: 1,-2147483648
任何帮助将不胜感激,谢谢