YouTube API

Last updated

The YouTube Application Programming Interface (YouTube API) 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." [1]

Contents

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. [2]

Player APIs and tools

Android

  • Player API
  • Player API sample app
  • Player API Reference
  • YouTube Direct sample app

The minimum version supported of Android for the most recent versions of the API's is currently version 2.2. The Android device must also be running the YouTube app version 4.2.16. From then, using a web key, it is possible to use Googles API's through a developer enabled Android phone. [3]

iOS

  • Player IFrame API
  • YouTube Direct Sample App

Using the iOS versions of the API's is very similar to the Android explanation. However it involves using the Google Cloud Console. From there you are able to control the API's and set up the API's to work with your videos. You will also need a Client ID and a Client Secret; which can both be downloaded from Google's API Site. After this, it is a simple process of running the sample and the API's should then be properly integrated. [4]

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

The Data and Analytics APIs section briefly describes APIs that let your application access features and data normally available on the YouTube website. [5]

YouTube API V3

The YouTube Data API (v3) 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.insertPosts a bulletin for a specific channel. (The user submitting the request must be authorized to act on the channel's behalf.)

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.listReturns 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.insertUploads 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.deleteDeletes a channelSection.
youtube.channelSections.insertAdds a channelSection for the authenticated user's channel.
youtube.channelSections.listReturns channelSection resources that match the API request criteria.
youtube.channelSections.updateUpdate a channelSection.
youtube.channels.listReturns a collection of zero or more channel resources that match the request criteria.
youtube.channels.updateUpdates a channel's metadata.
youtube.guideCategories.listReturns a list of categories that can be associated with YouTube channels.
youtube.i18nLanguages.listReturns a list of supported languages.
youtube.i18nRegions.listReturns a list of supported regions.
youtube.liveBroadcasts.bindBinds 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.controlControls the settings for a slate that can be displayed in the broadcast stream.
youtube.liveBroadcasts.deleteDeletes a broadcast.
youtube.liveBroadcasts.insertCreates a broadcast.
youtube.liveBroadcasts.listReturns a list of YouTube broadcasts that match the API request parameters.
youtube.liveBroadcasts.transitionChanges 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.updateUpdates a broadcast. For example, you could modify the broadcast settings defined in the liveBroadcast resource's contentDetails object.
youtube.liveStreams.deleteDeletes a video stream.
youtube.liveStreams.insertCreates a video stream. The stream enables you to send your video to YouTube, which can then broadcast the video to your audience.
youtube.liveStreams.listReturns a list of video streams that match the API request parameters.
youtube.liveStreams.updateUpdates 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.deleteDeletes a playlist item.
youtube.playlistItems.insertAdds a resource to a playlist.
youtube.playlistItems.listReturns 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.updateModifies a playlist item. For example, you could update the item's position in the playlist.
youtube.playlists.deleteDeletes a playlist.
youtube.playlists.insertCreates a playlist.
youtube.playlists.listReturns 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.updateModifies a playlist. For example, you could change a playlist's title, description, or privacy status.
youtube.search.listReturns 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.deleteDeletes a subscription.
youtube.subscriptions.insertAdds a subscription for the authenticated user's channel.
youtube.subscriptions.listReturns subscription resources that match the API request criteria.
youtube.thumbnails.setUploads a custom video thumbnail to YouTube and sets it for a video.
youtube.videoCategories.listReturns a list of categories that can be associated with YouTube videos.
youtube.videos.deleteDeletes a YouTube video.
youtube.videos.getRatingRetrieves the ratings that the authorized user gave to a list of specified videos.
youtube.videos.insertUploads a video to YouTube and optionally sets the video's metadata.
youtube.videos.listReturns a list of videos that match the API request parameters.
youtube.videos.rateAdd a like or dislike rating to a video or remove a rating from a video.
youtube.videos.updateUpdates a video's metadata.
youtube.watermarks.setUploads a watermark image to YouTube and sets it for a channel.
youtube.watermarks.unsetDeletes 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. [6]

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. [7]
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 (the traditional API's) include:
Analytics API's

Data API

Advantages

A great advantage of using YouTube's API's is that 3rd party companies are able to arrange pay per click coupled with advertising for your videos. This allows the video uploader to receive money for the work they have put into their videos. [8] 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. [9] Another advantage of using the YouTube APIs is that as there are hundreds of hours of footage, however with using an API, it is easy to select the data and videos to store on a 3rd party site. [10]

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. [11]
There are also problems currently (October 2014) 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. [12]
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. [13]

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. [14]

See also

Related Research Articles

A software development kit (SDK) is a collection of software development tools in one installable package. They ease creation of applications by having compiler, debugger and perhaps a software framework. They are normally specific to a hardware platform and operating system combination. To create applications with advanced functionalities such as advertisements, push notifications, etc; most application software developers use specific software development kits.

Google Maps Web mapping service by Google

Google Maps is a web mapping service developed by Google. It offers satellite imagery, aerial photography, street maps, 360° panoramic views of streets, real-time traffic conditions, and route planning for traveling by foot, car, bicycle and air, or public transportation.

Google Developers is Google's site for software development tools, application programming interfaces (APIs), and technical resources. The site contains documentation on using Google developer tools and APIs—including discussion groups and blogs for developers using Google's developer products.

Android (operating system) Free and open-source operating system for mobile devices, developed by Google

Android is a mobile operating system based on a modified version of the Linux kernel and other open source software, designed primarily for touchscreen mobile devices such as smartphones and tablets. Android is developed by a consortium of developers known as the Open Handset Alliance, with the main contributor and commercial marketer being Google.

Dialogflow is a Google-owned developer of human–computer interaction technologies based on natural language conversations. The company is best known for creating the Assistant, a virtual buddy for Android, iOS, and Windows Phone smartphones that performs tasks and answers users' question in a natural language. Speaktoit has also created a natural language processing engine that incorporates conversation context like dialogue history, location and user preferences.

Google APIs is a set of application programming interfaces (APIs) developed by Google which allow communication with Google Services and their integration to other services. Examples of these include Search, Gmail, Translate or Google Maps. Third-party apps can use these APIs to take advantage of or extend the functionality of the existing services.

Google Keep software

Google Keep is a note-taking service developed by Google. Launched on March 20, 2013, Google Keep is available on the web, and has mobile apps for the Android and iOS mobile operating systems. Keep offers a variety of tools for taking notes, including text, lists, images, and audio. Users can set reminders, which are integrated with Google Now. Text from images can be extracted using optical character recognition, and voice recordings can be transcribed. The interface allows for a single-column view or a multi-column view. Notes can be color-coded, and labels can be applied for organization. Later updates have added functionality to pin notes, and to collaborate on notes with other Keep users in real-time.

Google Cast, branded for consumer devices as Chromecast built-in, is a proprietary protocol developed by Google that enables mobile devices and personal computers to initiate and control playback of Internet-streamed audio/video content on a compatible device, such as a digital media player connected to a high-definition television or home audio system. The protocol was first launched on July 24, 2013, to support Google's first-generation Chromecast player. The Google Cast SDK was released on February 3, 2014, allowing third parties to modify their software to support the protocol. According to Google, over 20,000 Google Cast-ready apps were available as of May 2015. Google Cast would later be built into the Nexus Player and other Android TV devices, as well as soundbars, speakers, and subsequent Chromecast players. As of October 2017, over 55 million Chromecasts and Chromecast built-in devices have been sold.

Google Play Services is a proprietary background service and API package for Android devices from Google. When it was introduced in 2012, it provided access to the Google+ APIs and OAuth 2.0. It expanded to cover a variety of Google services, allowing applications to communicate with the services through common means.

Pressy Button

Pressy Button or Pressy is a programmable button that can be inserted into the headphone socket of a smartphone or tablet and used as an extra button to perform tasks on the device. It is also dubbed as the almighty Android button.

Firebase is a mobile and web application development platform developed by Firebase, Inc. in 2011, then acquired by Google in 2014. As of October 2018, the Firebase platform has 18 products, which are used by 1.5 million apps.

Android Lollipop version of the Android operating system

Android "Lollipop" is the fifth major version of the Android mobile operating system developed by Google and the 12th version of Android, spanning versions between 5.0 and 5.1.1. Unveiled on June 25, 2014 at the Google I/O 2014 conference, it became available through official over-the-air (OTA) updates on November 12, 2014, for select devices that run distributions of Android serviced by Google. Its source code was made available on November 3, 2014. It is the fifth major update and the twelfth version of Android.

Microsoft Garage software

The Microsoft Garage is a Microsoft program that encourages employees to work on projects that they are passionate about, even if they have no relation to their primary function within the company. Employees from all divisions of Microsoft are free to take part in Microsoft Garage activities and small-scale innovation projects. The Microsoft Garage is a global program with locations on the main campus in Redmond, Washington, and several others spread all over the world, and a website that launched in October 2014 to share experimental projects with customers.

Eddystone is a Bluetooth Low Energy beacon profile released by Google in July 2015. The Apache 2.0-licensed, cross-platform, and versioned profile contains several frame types, including Eddystone-UID, Eddystone-URL, and Eddystone-TLM. Eddystone-URL is used by the Physical Web project, whereas Eddystone-UID is typically used by native apps on a user's device, including Google's first party apps such as Google Maps.

LineageOS Free and open-source operating system based on Android

LineageOS is a free and open-source operating system for smartphones, tablet computers, and set-top boxes, based on the Android mobile platform. It is the successor to the custom ROM CyanogenMod, from which it was forked in December 2016 when Cyanogen Inc. announced it was discontinuing development and shut down the infrastructure behind the project. Since Cyanogen Inc. retained the rights to the Cyanogen name, the project rebranded its fork as LineageOS.

Google Gesture Search software

Google Gesture Search was released on March 3, 2010 as a new application for Android Eclair operating system and above, which enabled users to search their phone’s contacts, bookmarks, applications and music simply by scribbling out letters with their finger.

Android Oreo Eighth major version of the Android mobile operating system

Android "Oreo" is the eighth major release and the 15th version of the Android mobile operating system. It was first released as an alpha quality developer preview in March 2017 and released to the public on August 21, 2017.

Flutter (software) open-source framework to develop mobile apps

Flutter is an open-source UI software development kit created by Google. It is used to develop applications for Android, iOS, Windows, Mac, Linux, Google Fuchsia and the web.

References

  1. "API Resources". YouTube API. Retrieved 7 October 2014.
  2. "Players and Player APIs" . Retrieved 28 November 2014.
  3. Francis, William. "Using Google's API In Your Android Apps". TechRepublic UK. Retrieved 24 October 2014.
  4. "YouTube Direct Lite for iOS". GitHub. GitHub Inc. Retrieved 24 October 2014.
  5. "Data and Analytics APIs" . Retrieved 28 November 2014.
  6. "Buttons, Widgets, and Tools" . Retrieved 28 November 2014.
  7. "Obtaining a simple API key for use with the YouTube API". ZixMp4. Google Developers. Retrieved 25 October 2014.
  8. Litt, Michael. "How To: Benefit From Using YouTube". VidYard. VidYard. Retrieved 24 October 2014.
  9. Wagner, Janet. "The Increasing Importance of APIs In Web Development". Tuts+. Tuts+. Retrieved 24 October 2014.
  10. Arno, Christian. "The Advantages of Social Media APIs". Search Engine Journal. Search Engine Journal. Retrieved 27 October 2014.
  11. "First time using YouTube's APi" . Retrieved 2007-03-17.
  12. "what the advantage or disadvantages if i used youtube-API or present the video in a webview". StackOverflow. StackOverflow. Retrieved 24 October 2014.
  13. bh6712121. "Why Steam Music Won't Replace My Music Player". YouTube. bh6712121. Retrieved 25 October 2014.
  14. Purifier, HTML. "Embedding YouTube Videos". HTML Purifier. HTML Purifier. Retrieved 27 October 2014.