我正在尝试使用以下代码在我的android应用程序中播放RTSP url:
String url = "rtsp://mobilestr1.livestream.com/livestreamiphone/nyc";
Uri uri = Uri.parse(url);
System.out.println("URL="+url);
startActivity(new Intent(Intent.ACTION_VIEW, uri));但是,几秒钟后会弹出一个警告对话框,提示“无法播放视频”。我尝试了几个RTSP urls,但它们都不起作用。我做错了什么?
谢谢
发布于 2012-08-07 22:47:38
这个流就是android MPEG-4avc第10部分,它不能在大多数h264设备上运行。这个页面有一个列表,列出了什么是有效的。但本质上,您需要一个MPEG-4基准流。
http://developer.android.com/guide/appendix/media-formats.html#recommendations
如果您在VLC中打开流,然后:窗口>媒体信息>编解码器详细信息,您也可以验证此信息
发布于 2019-02-18 21:46:01
尝试下面的代码。这对我很管用。不要忘记在您的清单中添加internet权限。
private void rtspStream(String rtspUrl) {
mVideoView.setVideoURI(Uri.parse(rtspUrl));
mVideoView.requestFocus();
mVideoView.start();
}https://stackoverflow.com/questions/11848359
复制相似问题