explaingit

pierfrancescosoffritti/android-youtube-player

Analysis updated 2026-07-03

3,691KotlinAudience · developerComplexity · 2/5Setup · easy

TLDR

An Android library that adds reliable YouTube video playback to your app using YouTube's own web player, replacing Google's deprecated official API.

Mindmap

mindmap
  root((android-youtube-player))
    What it does
      YouTube playback in Android
      WebView IFrame approach
      Terms of service compliant
    Features
      Lifecycle aware
      Auto pause off screen
      Chromecast extension
    Integration
      YouTubePlayerView layout
      Listener callbacks
      Video ID playback
    Audience
      Android developers
      Kotlin and Java apps
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Embed a YouTube video player in an Android screen with just a few lines of Kotlin, handling lifecycle and pause-on-scroll automatically.

USE CASE 2

Let users cast YouTube videos from your Android app to a Chromecast device using the included Chromecast extension.

USE CASE 3

Replace a deprecated Google YouTube Android Player API integration in an existing app with a compliant, maintained alternative.

USE CASE 4

Listen to playback state changes like playing, paused, or ended to sync your app's UI with the video player.

What is it built with?

KotlinJavaAndroidWebView

How does it compare?

pierfrancescosoffritti/android-youtube-playergradle/kotlin-dsl-samplesbufferapp/android-clean-architecture-boilerplate
Stars3,6913,6873,686
LanguageKotlinKotlinKotlin
Setup difficultyeasyeasymoderate
Complexity2/52/53/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 30min

Requires Android API level 21 or higher, Chromecast support is a separate optional module.

License terms are not described in the explanation.

In plain English

android-youtube-player is an open-source library for Android developers who want to add YouTube video playback to their apps. It was created because Google's own YouTube Android Player API was unreliable and has since been officially deprecated. Google now recommends the IFrame Player API approach, which embeds YouTube's own web player inside a WebView, and this library does exactly that while providing a clean Java and Kotlin interface so developers do not have to work with the web layer directly. Because the library uses YouTube's own web player internally, it is compliant with YouTube's terms of service. Playing videos through a WebView is the method Google recommends on both Android and iOS. Adding a YouTube player to an Android screen involves placing a YouTubePlayerView in your layout and initializing it with a listener. The listener gives you callbacks for when the player is ready, when playback state changes (playing, paused, buffering, ended), and other events. From there you can load videos by their YouTube ID, seek to positions, and control playback. The library automatically pauses playback when the player goes off screen, which is required by YouTube's terms of service. It also handles Android lifecycle events if you register it as a lifecycle observer. The library includes Chromecast support as a separate extension module. This lets users cast YouTube videos from an Android app to a Chromecast device. The Chromecast extension covers both the sender side (the Android app) and a receiver page that runs in the browser on the Chromecast. The library has been integrated into over 5,000 Android apps, including Tumblr, Flipkart, McDonald's, and others. Minimum supported Android API level is 21. The full README is longer than what was shown.

Copy-paste prompts

Prompt 1
Show me how to add android-youtube-player to my Android project and embed a YouTubePlayerView in an activity that plays a video by ID.
Prompt 2
I want my YouTube player to automatically pause when it scrolls off screen. How do I register android-youtube-player as a lifecycle observer in my Fragment?
Prompt 3
Write Kotlin code using android-youtube-player to listen for playback state changes and update a 'Now Playing' label in my app's UI.
Prompt 4
Help me add Chromecast support to my Android app using the android-youtube-player Chromecast extension module.

Frequently asked questions

What is android-youtube-player?

An Android library that adds reliable YouTube video playback to your app using YouTube's own web player, replacing Google's deprecated official API.

What language is android-youtube-player written in?

Mainly Kotlin. The stack also includes Kotlin, Java, Android.

What license does android-youtube-player use?

License terms are not described in the explanation.

How hard is android-youtube-player to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is android-youtube-player for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Scan in gitsafehub Deploy in gitdeployhub pierfrancescosoffritti on gitmyhub

Verify against the repo before relying on details.