Alexis
Alexis

Reputation: 25163

Choose YouTube videos on Android?

I need a way for a user to choose a YouTube video.

Is there a way for a user to be in my application, push a button in my application, have them go into the YouTube application, have them choose a video in the YouTube application, then have them return to my application without the YouTube video starting, and returning with the UID of the YouTube video they chose?

I found this, but it only drops me into the YouTube application, I want to get out of the YouTube application before the video starts

Intent intent = new Intent(Intent.ACTION_SEARCH);
intent.setPackage("com.google.android.youtube");
intent.putExtra("query", "Android");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);

Advice on this would great.

Upvotes: 0

Views: 710

Answers (1)

Nesim Razon
Nesim Razon

Reputation: 9794

I don't think that it possible but you can use youtube api for searching videos.

You can have a look at api documantation here:

https://developers.google.com/youtube/2.0/developers_guide_protocol_api_query_parameters

For example, a request to the following URL searches for the second set of 10 recently uploaded videos matching the query term "football" but not matching the query term "soccer":

https://gdata.youtube.com/feeds/api/videos?q=football+-soccer&orderby=published&start-index=11&max-results=10&v=2

Upvotes: 1

Related Questions