Using the YouTube API to Embed Video in an Android App

Using the YouTube API to Embed Video in an Android App

The YouTube Android Player API enables you to incorporate video playback functionality into your Android applications. The API allows you to load and play YouTube videos (and playlists) and to customize and control the video playback experience.

[…]

Before using the Android Youtube API, you need to register your application, including your digitally signed .apk file’s public certificate in the Google Developers Console. To register the application, follow these steps.

[…]

Back in the Android app, create a class named Config.java and paste in the following.

[…]

Change back to the Android perspective, select the build.gradle (Module: app) file and add the following to the dependencies.

[…]

Add the following permission for internet access to the AndroidManifest.xml file as a child of the manifest tag and a sibling to the application.

[…]

The YouTube Android library provides a great API that enables you to customise this experience and we’ve only touched on its capabilities. To find out more about the library, be sure to read through the documentation and the sample app that comes with the library download.

[…]