首页  编辑  

安卓下播放RTSP流媒体最简单的方法

Tags: /Android/   Date Created:
安卓下播放RTSP流媒体最简单的方法,下面代码中 video 是rtsp://user:password@192.168.1.111:554等流媒体URL
final VideoView vv = (VideoView) findViewById(R.id.video_view_h264);
        MediaController mc = new MediaController(getApplicationContext());
        vv.setVideoURI(video);
        vv.setMediaController(mc);
        vv.requestFocus();
        vv.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
            public void onPrepared(MediaPlayer mp) {
                vv.start();
            }
        });