Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.tommus:youtube-android-player-api:1.2.3'
}
dependencies {
implementation("com.github.tommus:youtube-android-player-api:1.2.3")
}
<dependency>
<groupId>com.github.tommus</groupId>
<artifactId>youtube-android-player-api</artifactId>
<version>1.2.3</version>
</dependency>
libraryDependencies += "com.github.tommus" % "youtube-android-player-api" % "1.2.3"
:dependencies [[com.github.tommus/youtube-android-player-api "1.2.3"]]
The YouTube Android Player API enables you to incorporate video playback functionality into your Android applications. The API defines methods for loading and playing YouTube videos (and playlists) and for customizing and controlling the video playback experience.
Using the API, you can load or cue videos into a player view embedded in your application's UI. You can then control playback programmatically. For example, you can play, pause, or seek to a specific point in the currently loaded video.
You can also register event listeners to get callbacks for certain events, such as the player loading a video or the player state changing. Finally, the API has helper functionality to support orientation changes as well as transitions to fullscreen playback.
As the library might be added to the project by pasting the jar
file into the libs
directory, many people prefer to
use Gradle.
This project makes adding YouTube Android Player API
into your project in two easy steps.
Add Jitpack repository address to the project build.gradle
:
allprojects {
repositories {
/* (...) */
maven { url "https://jitpack.io" }
}
}
Make sure that you have the $yapa_version
defined in your gradle file at the project level:
ext.yapa_version = "1.2.3"
Add dependency to the project:
dependencies {
compile "com.github.tommus:youtube-android-player-api:$versions.yapa_version"
}
Read more about the library at Google Developers website here.