YouTube API
The YouTube Application Programming Interface allows developers to access video statistics and YouTube channels data via two types of calls, REST and XML-RPC. Google describe the YouTube API Resources as "APIs and Tools that let you bring the YouTube experience to your webpage, application or device."
Players and Player APIs
The Players and Player APIs section identifies ways you can let your users watch YouTube videos in your application and control the playback experience. With an embedded YouTube player, you can integrate the YouTube video playback experience directly in your web page or application. You can use player parameters to customize the player's appearance, and you can also use Player APIs to control the player directly from your web page or app.Player APIs and tools
Android
- Player API
- Player API sample app
- Player API Reference
- YouTube Direct sample app
iOS
- Player IFrame API
- YouTube Direct Sample App
Other API's include resources that can be implemented into a 3rd party website. These are the usual social network integrated API's that we regularly come across such as the Facebook like button or the Twitter follow button. YouTube widget API's include:
- Subscribe Button
- Upload Widget
- Player API Demo
- Player API Code Playground
Data and Analytics APIs
YouTube API V3
The YouTube Data API lets you incorporate YouTube functionality into your own application. You can use the API to fetch search results and to retrieve, insert, update, and delete resources like videos or playlists.
In conjunction with the YouTube Player APIs and the YouTube Analytics API, the API lets your application provide a full-fledged YouTube experience that includes search and discovery, content creation, video playback, account management, and viewer statistics.
youtube.activities.insert | Posts a bulletin for a specific channel. Note: Even though an activity resource can contain information about actions like a user rating a video or marking a video as a favorite, you need to use other API methods to generate those activity resources. For example, you would use the API's videos.rate method to rate a video and the playlistItems.insert method to mark a video as a favorite. |
youtube.activities.list | Returns a list of channel activity events that match the request criteria. For example, you can retrieve events associated with a particular channel, events associated with the user's subscriptions and Google+ friends, or the YouTube home page feed, which is customized for each user. |
youtube.channelBanners.insert | Uploads a channel banner image to YouTube. This method represents the first two steps in a three-step process to update the banner image for a channel: - Call the channelBanners.insert method to upload the binary image data to YouTube. The image must have a 16:9 aspect ratio and be at least 2120x1192 pixels. - Extract the url property's value from the response that the API returns for step 1. - Call the channels.update method to update the channel's branding settings. Set the brandingSettings.image.bannerExternalUrl property's value to the URL obtained in step 2. |
youtube.channelSections.delete | Deletes a channelSection. |
youtube.channelSections.insert | Adds a channelSection for the authenticated user's channel. |
youtube.channelSections.list | Returns channelSection resources that match the API request criteria. |
youtube.channelSections.update | Update a channelSection. |
youtube.channels.list | Returns a collection of zero or more channel resources that match the request criteria. |
youtube.channels.update | Updates a channel's metadata. |
youtube.guideCategories.list | Returns a list of categories that can be associated with YouTube channels. |
youtube.i18nLanguages.list | Returns a list of supported languages. |
youtube.i18nRegions.list | Returns a list of supported regions. |
youtube.liveBroadcasts.bind | Binds a YouTube broadcast to a stream or removes an existing binding between a broadcast and a stream. A broadcast can only be bound to one video stream. |
youtube.liveBroadcasts.control | Controls the settings for a slate that can be displayed in the broadcast stream. |
youtube.liveBroadcasts.delete | Deletes a broadcast. |
youtube.liveBroadcasts.insert | Creates a broadcast. |
youtube.liveBroadcasts.list | Returns a list of YouTube broadcasts that match the API request parameters. |
youtube.liveBroadcasts.transition | Changes the status of a YouTube live broadcast and initiates any processes associated with the new status. For example, when you transition a broadcast's status to testing, YouTube starts to transmit video to that broadcast's monitor stream. Before calling this method, you should confirm that the value of the status.streamStatus property for the stream bound to your broadcast is active. |
youtube.liveBroadcasts.update | Updates a broadcast. For example, you could modify the broadcast settings defined in the liveBroadcast resource's contentDetails object. |
youtube.liveStreams.delete | Deletes a video stream. |
youtube.liveStreams.insert | Creates a video stream. The stream enables you to send your video to YouTube, which can then broadcast the video to your audience. |
youtube.liveStreams.list | Returns a list of video streams that match the API request parameters. |
youtube.liveStreams.update | Updates a video stream. If the properties that you want to change cannot be updated, then you need to create a new stream with the proper settings. |
youtube.playlistItems.delete | Deletes a playlist item. |
youtube.playlistItems.insert | Adds a resource to a playlist. |
youtube.playlistItems.list | Returns a collection of playlist items that match the API request parameters. You can retrieve all of the playlist items in a specified playlist or retrieve one or more playlist items by their unique IDs. |
youtube.playlistItems.update | Modifies a playlist item. For example, you could update the item's position in the playlist. |
youtube.playlists.delete | Deletes a playlist. |
youtube.playlists.insert | Creates a playlist. |
youtube.playlists.list | Returns a collection of playlists that match the API request parameters. For example, you can retrieve all playlists that the authenticated user owns, or you can retrieve one or more playlists by their unique IDs. |
youtube.playlists.update | Modifies a playlist. For example, you could change a playlist's title, description, or privacy status. |
youtube.search.list | Returns a collection of search results that match the query parameters specified in the API request. By default, a search result set identifies matching video, channel, and playlist resources, but you can also configure queries to only retrieve a specific type of resource. |
youtube.subscriptions.delete | Deletes a subscription. |
youtube.subscriptions.insert | Adds a subscription for the authenticated user's channel. |
youtube.subscriptions.list | Returns subscription resources that match the API request criteria. |
youtube.thumbnails.set | Uploads a custom video thumbnail to YouTube and sets it for a video. |
youtube.videoCategories.list | Returns a list of categories that can be associated with YouTube videos. |
youtube.videos.delete | Deletes a YouTube video. |
youtube.videos.getRating | Retrieves the ratings that the authorized user gave to a list of specified videos. |
youtube.videos.insert | Uploads a video to YouTube and optionally sets the video's metadata. |
youtube.videos.list | Returns a list of videos that match the API request parameters. |
youtube.videos.rate | Add a like or dislike rating to a video or remove a rating from a video. |
youtube.videos.update | Updates a video's metadata. |
youtube.watermarks.set | Uploads a watermark image to YouTube and sets it for a channel. |
youtube.watermarks.unset | Deletes a watermark. |
Buttons, Widgets, and Tools
The Buttons, Widgets, and Tools section describes other tools you can use to add YouTube functionality to your app or to test YouTube APIs.How To Use YouTube's API
To use YouTube's API, a developer must acquire a Developer ID - this is an additional property that is attached to the developer's YouTube account. The information that is available to developers is similar to the information that can be acquired by accessing YouTube's many RSS feeds. Since the integration of Google and YouTube it is possible to log into YouTube using an existing Google account. An easy to use tutorial can be found as a YouTube video.The API's have since been extended and are now compatible with many mobile operating platforms such as Android and iOS. Quite obviously the Android API's are more complete with the iOS resources somewhat lacking. A list of this API's available for both platforms are below:
Other YouTube API's include:
Analytics API's
- Getting Started
- Code Samples
- API Reference
- Sample Requests
- Sample Application
- Getting Started
- Sample Requests
- Guides and Tutorials
- API Reference
- API Explorer
Advantages
YouTube API's also allow a tighter integration of the video service into a 3rd party website. This essentially means that the user does not need to click a link to go to the YouTube video. Instead, they are able to view the video in the same page that they are visiting.
Another advantage of using the YouTube APIs is that it is easier to select the specific data and videos to be stored on a 3rd party site.
Disadvantages
During a period that included March 2006, API calls from Flash were disabled due to security concerns. These, however, have since been re-enabled.There are also problems currently with the orientation on Android devices. Even by adding the fullscreen to the AndroidManifest, it still does not load properly in the correct full screen orientation.
YouTube also does not allow videos to run whilst the Android device is sleeping. This can be seen as an annoyance for some users. Particularly if the user is trying to use YouTube as a replacement music player.
Overall, the YouTube API's help the user with certain pieces of code. If the code snippet is already present, there is no need for each user to recreate this code as it has been supplied by YouTube themselves.