Hi Guys streaming Video from youtube is quite easily

Define inside your layout folder a file called Multimedia.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android";
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Video Playback JOC" />
    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/frame">
        <VideoView
            android:id="@+id/video"
            android:layout_width="226px"
            android:layout_height="194px"
            android:keepScreenOn="true" />
    </RelativeLayout>
</LinearLayout>



And this is the code!

private static final String RTSP = "rtsp://v4.cache2.c.youtube.com/
CkELENy73wIaOAng93Xa-
iQH5xMYESARFEIJbXYtZ29vZ2xlSARSBXdhdGNoWglDbGlja0xpbmtgg9fFkeTLublGDA==/
0/0/0/video.3gp";


        setContentView(R.layout.Multimedia);
        //***VideoView to video element inside Multimedia.xml file
        VideoView videoView = (VideoView) findViewById(R.id.video);
        Log.v("Video", "***Video to Play:: " + RTSP);
        MediaController mc = new MediaController(this);
        mc.setAnchorView(videoView);
        Uri video = Uri.parse(RTSP);
        videoView.setMediaController(mc);
        videoView.setVideoURI(video);
        videoView.start();

any Question? :D
Enjoy Coding!

Jorgesys
www.reforma.com


On 13 oct, 06:09, furby <[email protected]> wrote:
> I am sure that this has been discussed before... But I don't seem to
> be really grokking it...
>
> I have a videoview called "tv1" on a form.
> I have a bit of code that fires when a button is pressed that looks
> like this :
>                 String uristr = "rtsp://rtsp.youtube.com/youtube/
> videos/S2eoCqwBCQI/video.3gp";
>                 tv1.setVideoURI(Uri.parse(uristr));
>                 tv1.start();
>
> The emulator tells me that "This video cannot be displayed" and if I
> try it on my phone, the app just crashes...
>
> Does anyone know what I am doing wrong here?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to