appukrb
appukrb

Reputation: 1507

Video Stream Using RTSP in android

i have used the following code to run the rtsp link in videoview

    videoView.setMediaController(null);
    str = "rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov";
    uri = Uri.parse(str);
    videoView.setVideoURI(uri);
    videoView.requestFocus();
    videoView.start();

it works fine in Android2.3.3 but it throw exception in Android 4.0

java.io.IOException: setDataSource failed.: status=0x80000000

Upvotes: 1

Views: 1878

Answers (1)

Aditya Kushwaha
Aditya Kushwaha

Reputation: 837

I worked with VideoView that worked fine on 4.1 I made use of MediaController. Heres my code:

webView.setVideoURI(Uri.parse(videoUrl));

        // media control 
        webView.requestFocus();  
        MediaController mediaController = new MediaController(this);
        mediaController.setAnchorView(webView); 
        webView.setMediaController(mediaController);  

        webView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
            public void onPrepared(MediaPlayer mp) {
                // TODO Auto-generated method stub
                Log.d("VideoActivity","onPrepareListener");
                try {
                    progressDialog.dismiss();
                    webView.start();
                }
                catch (Exception e) {
                    // TODO: handle exception
                    e.printStackTrace();
                }
            }
        });

Upvotes: 1

Related Questions