Streaming Youtube Videos Streaming Youtube Videos android android

Streaming Youtube Videos


If you're willing to do the work in a new activity, the following will work on a device but not on the emulator:

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com/watch?v=cxLG2wtE7TM")));


Sometimes Uri.parse return "null" because cant parse an rtsp protocol instead of http protocol.

Look it with an Log in logcat Uri.parse(rtspURL).toString() and you will see nothing written. or only make Log.d("tag", Uri.parse); and the same will be return.

Try to find another way to parse (create) an Uri.

I'd try with that and run:

String urlVideo = <your rtspURL>VideoView video = (VideoView)findViewById(R.id.VideoView01);Log.d(tag , urlVideo);video.setVideoURI(Uri.parse(urlVideo));MediaController mc = new MediaController(this);video.setMediaController(mc);video.requestFocus();video.start();mc.show();


I'm impressed that the dirty way works at all! If you've got a working solution, go with it. I don't think there's a clean way to get RTSP streaming working in the SDK yet.