Possible duplicate this question but I can't find the answer for my problem.
I tried to read Youtube channel document, but I don't understand how to receive the channel information by its name, for example from BBC news . And I tried to follow sample code in java to search video and I can get the videos list by search term. I just wonder is there any way to get playlists (which contain video id) of special public channel by its name, then I can video in playlist by id? And do I need to know its id?
Finally I can get it by using Http GET API from Google. Here is an example for someone need them:
First, I get the channel id by using channel API like this:
https://www.googleapis.com/youtube/v3/channels?part=id%2Csnippet&forUsername=bbcnews&key={YOUR_API_KEY}
Then I used Search API to get the videos and playlist of this channel by id:
https://www.googleapis.com/youtube/v3/search?part=id%2C+snippet&channelId=UC16niRr50-MSBwiO3YDb3RA&maxResults=50&order=date&type=video%2C+playlist&key={YOUR_API_KEY}
Here is the place where you can try Youtube API.
You can try this request
"https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=" + channelId + "&pageToken=" +pageToken + "&key=YOUR_KEY"
Related
I saw on many applications that they can get the info of current playing youtube video's title, duration etc on there application.
See this response
title: Desiigner- Panda (OFFICIAL SONG) Prod. By: Menace
album: null
artist: Desiigner LOD
duration: 248000
position: 33154
positionTimestamp: 438260822
source: com.google.android.youtube
playing: true
artworkUri: null
supportedActions: 560
May I know how I can get this info on my application ?
Well, if you want to get data for Youtube Videos or play Youtube Videos on your app etc. you can use the YouTube Data API. It's easy to integrate and it's Google's official API for getting video data from youtube. If you want to use the whole Youtube API you can also look at the documentation. You can look at the Github samples for the API. Good Luck!
They get this information via logcat:
HI I am developing an android app. I'm using Youtube API v3.
As I mention on question title, Is there way? because I send command to Youtube server, they return video and live streaming.
I tried to find options to exclude live streaming video but I couldn't.
Try using videos.list to retrieve non-livestreaming videos in Youtube. Use the HTTP request
GET https://www.googleapis.com/youtube/v3/videos
to perform the operation.
Give the Try-it a go to see the results in your browser right now.
Since you're using Android, this code snippet from the same page might give you an idea:
// Call the YouTube Data API's youtube.videos.list method to
// retrieve the resources that represent the specified videos.
YouTube.Videos.List listVideosRequest = youtube.videos().list("snippet, recordingDetails").setId(videoId);
VideoListResponse listResponse = listVideosRequest.execute();
List<Video> videoList = listResponse.getItems();
I am trying to create a Youtube based application and I can't find any information on how to subscribe the users to different channels.
Is it possible to do it? I can find information about how to do it using php but I'm wasting lots of time with no success trying to do it with Android.
You may want to look at the following content for accessing different Youtube channels?. There are also sample Android apps showing how to use the Youtube API.
To locate the referenced method, use the original source link below. Make sure that you are clicking the YoutubeIntents class or try this direct link. You can find the YoutubeAPI Player on the downloads page and sample applications may be found at this link.
(original source)
Below code will open channel in youtube app.
private void openChannel(){
String channelId = "";// put channel id
Intent intent = YouTubeIntents.createChannelIntent(getContext(),channelId);
startActivity(intent);
}
am working on youtube player using youtube v3 api. I tried to add video duration using part=ContentDetails to my video search request, but it keeps returning error for contentDetails/duration. Does anybody have any means of getting around this problem. Here is my search request Url code below.
https://www.googleapis.com/youtube/v3/search?contentDetailsorder=viewCount&q=;&type=video&maxResults=14&part=snippet,&fields=items(id/videoId,snippet/title,snippet/thumbnails,contentDetails/duration)&key= Constants.YOUTUBE_API_KEY;
The Search:List call does not return the duration of a video in its search results. All the fields available can be seen here.
In order to get the duration of the videos call Videos:List with the id field set to a comma delimited list of the videoIds that you get from the search call. For instance:
GET https://www.googleapis.com/youtube/v3/videos?part=contentDetails&id=RgKAFK5djSk%2Cw1oM3kQpXRo&key={YOUR_API_KEY}
you can then access contentDetails\Duration for each of the videos.
I'm currently developing an android mobile app. I see that private Vimeo videos are not playing. Check the attached screen shot. Also note that the android app is still on development mode and not uploaded to Google. Please help me in this regard.
Regards,
Niladri!
private vimeo video not playing
That picture appears to be accessing vimeo.com directly to view videos. At vimeo.com, private videos can only be viewed if you are logged in (which is unrelated to the API).
If you want to play a private video in your application you will need to follow one of the following workflows:
Embedded in a webview
Mark your video as hidden from vimeo, yet embeddable, in your video's settings
Make an API request to /videos/{video_id} and extract the embed code from the response body (response.embed.html)
Put the embed code in your webview's html
Played in the Native Player (Vimeo PRO only)
Mark your video with any privacy setting
Make an API request to /videos/{video_id}
Find the collection of video files (response.files)
Loop through the video files to find the best height and width for your target player
Load the link into your native player
You can read more about the Vimeo API at https://developer.vimeo.com/api, and https://developer.vimeo.com/api/endpoints
If you want to play private Vimeo videos of your Vimeo account in an Android Application then follow the steps below:
Go to your video privacy settings and mark it as hidden from Vimeo and embed anywhere.
Make an API request to this endpoint: https://api.vimeo.com/users/{your_user_id}/videos
Get the embed.html string from the API response.
Load embed.html obtained in the previous step into your WebView.
For Vimeo Android SDK: https://github.com/vimeo/vimeo-networking-java
You can retrieve the Video endpoint by calling an auth-enabled REST API and then play it using a player(I used Exoplayer in android).
Follow below steps:
API Registration: You will need an application registered with the Vimeo API. If you do not already have an application registered, you can do so here.
You can generate an access token in the Authentication tab once you select your app from the list here.
With this access token you'll be able to make any requests that the access token's scope allows. You will NOT be able to switch accounts if you only supply the access token.
Call rest API with the access token in the header like below
Endpoint:
https://api.vimeo.com/videos/{VIDEO_ID}
Header:
Authorization:bearer ACCESS_TOKEN
VIDEO_ID is the id of video uploaded to Vimeo(Some number eg: 45334535)
ACCESS_TOKEN is the token you got after API Registration
This steps worked for me. I hope this will help someone.
We have a special google's SDK for YouTube for instance. On the other side AOS does not support Adobe Flash. Maybe its just has an unsupported by AOS video codec used by vimeo service? That could be the reason why you cant watch vimeo videos via WebView/browser.
Did you check for Vimeo official Android SDK if such thing does exist at least?
Also check this
And a little suggest: try to use SO search and google - it helps in most cases :)