我正在制作一个使用videoview的应用程序。我有以下错误。
1.我有一个视频视频,我正在播放来自" rtsp://cdn.m.yupptv.tv/liveorigin/we2" 它正在发挥作用。
2.现在我打算从这个网址播放视频" rtsp://192.168.13.77:8086 / stream.sdp" ,所以它没有工作&它提示我对话框"无法播放此视频"。
3.视频查看播放.sdp文件有什么问题吗?
这是我的源代码
public class Demo extends Activity
{
private static ProgressDialog progressDialog;
String videourl;
VideoView videoView ;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.video);
videourl = Constant.URL;
videoView = (VideoView) findViewById(R.id.video_View);
progressDialog = ProgressDialog.show(Demo.this, "", "Buffering video...",true);
progressDialog.setCancelable(false);
PlayVideo();
}
private void PlayVideo()
{
try
{
getWindow().setFormat(PixelFormat.TRANSLUCENT);
MediaController mediaController = new MediaController(Demo.this);
mediaController.setAnchorView(videoView);
Uri video = Uri.parse(videourl);
videoView.setMediaController(mediaController);
videoView.setVideoURI(video);
videoView.requestFocus();
videoView.setOnPreparedListener(new OnPreparedListener()
{
public void onPrepared(MediaPlayer mp)
{
progressDialog.dismiss();
videoView.start();
}
});
}
catch(Exception e)
{
progressDialog.dismiss();
System.out.println("Video Play Error :"+e.toString());
finish();
}
}
@Override
public void onBackPressed()
{
// TODO Auto-generated method stub
super.onBackPressed();
finish();
Intent i = new Intent(Demo.this,GetURL.class);
startActivity(i);
}
} 请帮帮我..,我从2天开始为这个解决方案做准备,但是没有得到适当的解决方案。谢谢提前.. :)