[android-developers] Re: Stream youtube to a videoview?

2009-11-28 Thread Jorgesys

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 wookie...@gmail.com 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Stream youtube to a videoview?

2009-11-28 Thread Jorgesys
test

On 13 oct, 12:31, Timothy Collins wookie...@gmail.com wrote:
 It actually won't play any other video file I throw at it either...

 On Tue, Oct 13, 2009 at 2:30 PM, Roman ( T-Mobile USA) 

 roman.baumgaert...@t-mobile.com wrote:

  I noticed that I cannot play the file

  rtsp://rtsp.youtube.com/youtube/videos/S2eoCqwBCQI/video.3gp

  which you put in your source code

  on my desktop browser. The Android MediaPlayer is very sensitive. If
  the container format does not fit the one which is expected by the
  mediaPlayer, you won't be able to stream.

  --
  Roman Baumgaertner
  Sr. SW Engineer-OSDC
  ·T· · ·Mobile· stick together
  The views, opinions and statements in this email are those of the
  author solely in their individual capacity, and do not necessarily
  represent those of T-Mobile USA, Inc.

  On Oct 13, 5:09 am, furby wookie...@gmail.com 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Stream youtube to a videoview?

2009-11-28 Thread Jorgesys
test2

On 13 oct, 12:31, Timothy Collins wookie...@gmail.com wrote:
 It actually won't play any other video file I throw at it either...

 On Tue, Oct 13, 2009 at 2:30 PM, Roman ( T-Mobile USA) 

 roman.baumgaert...@t-mobile.com wrote:

  I noticed that I cannot play the file

  rtsp://rtsp.youtube.com/youtube/videos/S2eoCqwBCQI/video.3gp

  which you put in your source code

  on my desktop browser. The Android MediaPlayer is very sensitive. If
  the container format does not fit the one which is expected by the
  mediaPlayer, you won't be able to stream.

  --
  Roman Baumgaertner
  Sr. SW Engineer-OSDC
  ·T· · ·Mobile· stick together
  The views, opinions and statements in this email are those of the
  author solely in their individual capacity, and do not necessarily
  represent those of T-Mobile USA, Inc.

  On Oct 13, 5:09 am, furby wookie...@gmail.com 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Stream youtube to a videoview?

2009-10-13 Thread furby

Anybody?

On Oct 13, 8:09 am, furby wookie...@gmail.com 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Stream youtube to a videoview?

2009-10-13 Thread dadical

I've done this before.  I blogged about it here:
http://keyeslabs.com/joomla/index.php/blogs/i-think-im-becoming-an-android/51-polish-your-app-free-embeddable-android-youtube-activity.
There is source code in the blog entry.  Enjoy!

Dave

On Oct 13, 7:28 am, furby wookie...@gmail.com wrote:
 Anybody?

 On Oct 13, 8:09 am, furby wookie...@gmail.com 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Stream youtube to a videoview?

2009-10-13 Thread Timothy Collins
One stupid question... I can't get Eclipse to understand that the line :

String uristr = rtsp://rtsp.youtube.com/youtube/videos/ + page +
/video.3gp;

is a valid line (page is a String variable that includes the video I want
to play). It says that is invalid...

On Tue, Oct 13, 2009 at 11:26 AM, dadical keyes...@gmail.com wrote:


 I've done this before.  I blogged about it here:

 http://keyeslabs.com/joomla/index.php/blogs/i-think-im-becoming-an-android/51-polish-your-app-free-embeddable-android-youtube-activity
 .
 There is source code in the blog entry.  Enjoy!

 Dave

 On Oct 13, 7:28 am, furby wookie...@gmail.com wrote:
  Anybody?
 
  On Oct 13, 8:09 am, furby wookie...@gmail.com 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Stream youtube to a videoview?

2009-10-13 Thread dadical

In response to your comment on keyeslabs.com:

Yes, YouTube says we should use RTSP, but that doesn't work. Look at
their own YouTube implementation on Android, and you'll see that they
grab a mangled mp4 url, rather than rtsp (you can verify this by
looking at the logcat output while using YouTube player). Sure, this
will break at some point when YouTube changes its protocol, but for
now it's the best solution. RTSP fails in many situations on Android,
particularly when you're behind a firewall on WiFi and the server
can't communicate to the client. I went a long way down the RTSP road,
and ended up back here. Let me know if you find something different!

In any case, you're welcome to use the concepts in my impl to grab
your RTSP stream if that's the direction that you want to go.  You're
still going to need to get a token, etc., and all of that code is
available to you in my activity implementation.

dk

On Oct 13, 8:26 am, dadical keyes...@gmail.com wrote:
 I've done this before.  I blogged about it 
 here:http://keyeslabs.com/joomla/index.php/blogs/i-think-im-becoming-an-an
 There is source code in the blog entry.  Enjoy!

 Dave

 On Oct 13, 7:28 am, furby wookie...@gmail.com wrote:



  Anybody?

  On Oct 13, 8:09 am, furby wookie...@gmail.com 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?- Hide quoted text -

 - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Stream youtube to a videoview?

2009-10-13 Thread Roman ( T-Mobile USA)

I noticed that I cannot play the file

rtsp://rtsp.youtube.com/youtube/videos/S2eoCqwBCQI/video.3gp

which you put in your source code

on my desktop browser. The Android MediaPlayer is very sensitive. If
the container format does not fit the one which is expected by the
mediaPlayer, you won't be able to stream.

--
Roman Baumgaertner
Sr. SW Engineer-OSDC
·T· · ·Mobile· stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.

On Oct 13, 5:09 am, furby wookie...@gmail.com 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Stream youtube to a videoview?

2009-10-13 Thread Timothy Collins
It actually won't play any other video file I throw at it either...

On Tue, Oct 13, 2009 at 2:30 PM, Roman ( T-Mobile USA) 
roman.baumgaert...@t-mobile.com wrote:


 I noticed that I cannot play the file

 rtsp://rtsp.youtube.com/youtube/videos/S2eoCqwBCQI/video.3gp

 which you put in your source code

 on my desktop browser. The Android MediaPlayer is very sensitive. If
 the container format does not fit the one which is expected by the
 mediaPlayer, you won't be able to stream.

 --
 Roman Baumgaertner
 Sr. SW Engineer-OSDC
 ·T· · ·Mobile· stick together
 The views, opinions and statements in this email are those of the
 author solely in their individual capacity, and do not necessarily
 represent those of T-Mobile USA, Inc.

 On Oct 13, 5:09 am, furby wookie...@gmail.com 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---