youtube videos in my application

All your problems with Audio, Video and Images.

youtube videos in my application

Postby zakariadev » Sun Nov 28, 2010 11:50 pm

hello
I would like to know if possible to use youtube videos in my application. and if there is documentation or code.

thanks
zakariadev
Freshman
Freshman
 
Posts: 9
Joined: Mon Nov 15, 2010 8:22 am

Top

Re: youtube videos in my application

Postby blundell » Mon Nov 29, 2010 10:16 pm

Yes this is possible

Code: Select all
Button videoButton = (Button) findViewById(R.id.video);
      videoButton.setOnClickListener(new OnClickListener() {
         public void onClick(View v) {
            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com/watch?v=ZNZvG7IJwLs")));
         }
      });


Code: Select all
<Button
                                        android:id="@+id/video"
                                        android:layout_width="fill_parent"
                                        android:layout_height="wrap_content"
                                        android:text="@string/button_video"
                                        />
User avatar
blundell
Master Developer
Master Developer
 
Posts: 1610
Joined: Tue Nov 18, 2008 12:58 pm
Location: UK

Re: youtube videos in my application

Postby zakariadev » Tue Nov 30, 2010 4:30 am

hello
thank you for your help. but I have a problem is that I wish that the video starts in my application and not in the youtube page.
I tested your code but after click on button it loads the page youtube. then after the user clicks going to leave my application to the page of youtube.

thanks
zakariadev
Freshman
Freshman
 
Posts: 9
Joined: Mon Nov 15, 2010 8:22 am

Re: youtube videos in my application

Postby blundell » Tue Nov 30, 2010 9:54 am

Ah if you want to stream video within your app you will have to look at implementing your own video player:
Stream Video
Example App:
http://developer.android.com/resources/ ... Video.html
User avatar
blundell
Master Developer
Master Developer
 
Posts: 1610
Joined: Tue Nov 18, 2008 12:58 pm
Location: UK

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 8 guests