我正在尝试播放的.3gp文件从一个现场直播。以下是我的代码:
public class MainActivity extends Activity
{
// String path = "rtsp://v5.cache1.c.youtube.com/CjYLENy73wIaLQnhycnrJQ8qmRMYESARFEIJbXYtZ29vZ2xlSARSBXdhdGNoYPj_hYjnq6uUTQw=/0/0/0/video.3gp";
String path = "rtsp://217.146.95.166:554/live/ch12zqcif.3gp";
VideoView videoView = null;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
videoView =(VideoView)findViewById(R.id.videoView);
videoView.setVideoURI(Uri.parse(path));
videoView.setMediaController(new MediaController(this));
videoView.requestFocus();
videoView.start();
}
@Override
public void onBackPressed()
{
super.onBackPressed();
if ( videoView != null )
{
videoView.pause();
videoView = null;
}
}
}我已经在我的AnroidManifest.xml文件中授予了互联网权限。
当我用Youtube one加载第一个路径变量时,它是工作文件和加载视频,但第二个RTSP url不工作。
这会有什么问题呢?
发布于 2014-01-01 12:56:37
可能是您的URL有问题,请验证rtsp url。以下是how to playvideo with the videoview的示例。
干杯
https://stackoverflow.com/questions/20865593
复制相似问题