Hi Valentino, You won't be able to use that standard URL as you would in a browser. That will load a page with a flash player, which will play the embedded content. What you will want to do to use the Android player (which is not Flash) with YouTube content is to search with parameters specifying the video formats you would like, in such a way that you'll get the direct video streaming URLs instead of one for Flash.
You can read up on the YouTube api documentation to figure out how to search for valid video content. I've been playing with ( http://gdata-samples-youtube-search-py.appspot.com/) to get some samples to see the videos works at this point, though. Once I do the search there I grab a couple valid (H263, MPEG-4) URLs and throw them in the code. I have a slightly different implementation in my sand box, but this is how I'm doing it. Also, this did not work on the emulator, but it worked on a real G1. (The YouTube vids didn't work on the emulator, but if you want one I know works just to test your code try out " http://www.jhepple.com/SampleMovies/niceday.wmv" Side note: Flash looks like its only really supported on the HTC Hero for now, though to my understanding Adobe is working on expanding support for more platforms (so until then we're not grabbing the YouTube flash player in a WebView/browser) package com.myproject; import java.io.IOException; import android.app.Activity; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.MediaController; import android.widget.Toast; import android.widget.VideoView; public class VideoPlayer extends Activity { MediaController mediaController; VideoView video; // private static final String URIString = " http://www.jhepple.com/SampleMovies/niceday.wmv"; // h263 from you tube private static final String URIString = "rtsp:// v1.cache6.c.youtube.com/CiILENy73wIaGQkSUW_ygz76WhMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp "; // MPEG 4 from you tube // private static final String URIString = "rtsp:// v7.cache3.c.youtube.com/CiILENy73wIaGQlE0yg2wN9HwxMYESARFEgGUgZ2aWRlb3MM/0/0/0/video.3gp "; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.video_player); mediaController = new MediaController(this); video = (VideoView) findViewById(R.id.video_view); video.setVideoURI(Uri.parse(URIString)); video.setMediaController(mediaController); video.requestFocus(); video.requestFocus(); } } <?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" > <VideoView android:id="@+id/video_view" android:layout_width="320px" android:layout_height="240px" /> </LinearLayout> Steve On Sat, Dec 19, 2009 at 5:20 AM, Valentino XM <shourai...@gmail.com> wrote: > Hi All > i have tried mixing and matching code from several listed sources on > the development page. but cannot stream video from youtube using the > emulator. > > package info.shouraig.com; > > import java.io.IOException; > > import android.app.Activity; > import android.media.MediaPlayer; > import android.os.Bundle; > import android.util.Log; > import android.widget.TextView; > import android.widget.VideoView; > > public class Video2 extends Activity { > private static final String HTTP = "http://www.youtube.com/watch? > v=6ej-imJWuno <http://www.youtube.com/watch?%0Av=6ej-imJWuno>"; > VideoView ViewVideo2; > TextView textVideo2; > /** Called when the activity is first created. */ > @Override > public void onCreate(Bundle icicle) { > super.onCreate(icicle); > setContentView(R.layout.main); > Log.d("Video2", "***Video to Play::" + HTTP); > > //***VideoView to video > ViewVideo2 =(VideoView)findViewById(R.id.ViewVideo2); > MediaPlayer mp = new MediaPlayer(); > try { > mp.setDataSource(HTTP); > } catch (IllegalArgumentException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } catch (IllegalStateException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } catch (IOException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } > try { > mp.prepare(); > } catch (IllegalStateException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } catch (IOException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } > mp.start(); > } > } > > -- > You received this message because you are subscribed to the Google > Groups "Android Beginners" group. > To post to this group, send email to android-beginners@googlegroups.com > To unsubscribe from this group, send email to > android-beginners+unsubscr...@googlegroups.com<android-beginners%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/android-beginners?hl=en -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en