Library / SDK
PierfrancescoSoffritti/android-youtube-player avatar
PierfrancescoSoffritti/android-youtube-player

android-youtube-player: a WebView wrapper with six documented workarounds

YouTube Player library for Android and Chromecast, stable and customizable.

3,705 stars797 forksKotlinMIT

At a glance

What is it?
This library exists because Google's own YouTube player library for Android was deprecated, and it works by embedding the vendor's own web player in a WebView behind a native Kotlin view. Its README is mostly two tables of contents, and the honest parts are the terms of service section and a FAQ of workarounds.
Who is it for?
This library suits an Android app that must play YouTube video after Google's own player library was deprecated, and that wants a normal Android view with lifecycle handling rather than a web view in its layout. Three things to check first.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 12 days ago.
What is it written in?
Mainly Kotlin, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 24, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • PierfrancescoSoffritti/android-youtube-player3,705 ★ · +6
Star history
Repository2026-09-242026-11-24
PierfrancescoSoffritti/android-youtube-player3.7k3.7k

6 Stars in the last 61 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

It exists because Google's own player library was deprecated

The page answers its own existence question in the second section. Google shipped an official YouTube player library for Android, and this library's author describes it as historically unreliable, linking an old issue tracker thread, and as now deprecated by Google. Google's current recommendation is to use the browser-based player interface inside a WebView, which is precisely what this library does, with a native Kotlin interface in front of it so the host app never touches the WebView directly. So the architecture is not a preference; it is the vendor-mandated path, and the library's job is to make a WebView behave like an Android view. There is a sample app per module, a longer explanation on a personal blog, and a separate module for casting to a television, since that needs its own sender and receiver.

The terms of service answer depends on one behaviour

There is a dedicated question about breaking the vendor's terms of service, and the short answer is no, because the library plays video through YouTube's own web player inside a WebView, which the page notes is the approach the vendor recommends on both Android and its other mobile platform. The long answer is more interesting, because it is conditional. The page says how you use the library matters, and names the condition: play videos only when the player is visible. It then adds that if you follow the documented instructions the library handles that for you. So the compliance claim is not a property of the library alone; it depends on the app obeying a visibility rule, and the library's contribution is enforcing it. The same section gives one more piece of advice that has nothing to do with the library: when publishing, write the store listing so it is obvious your app has no affiliation with YouTube.

Six documented workarounds for what the embed interface will not do

The FAQ is titled workarounds and lists six of them, which tells you what the wrapper cannot fix. Changing video quality. Logging into a YouTube account. Skipping advertisements automatically. Removing interface elements that the documented controls parameter refuses to remove. Forcing subtitles to hide. And playing the next recommended video when one finishes. Each of these is a thing a native player library would have offered and a browser embed does not, so the wrapper reaches them through the parameters the embed interface does offer. That is a fair and useful thing to publish, and it is also the clearest statement of this library's shape: it is not a player, it is a well-behaved host for someone else's player. If your design needs a capability that is not in that list and not in the embed interface, this library will not provide it.

You have to release the player view yourself

Two entries in the core table of contents are about not leaking. One is a release method on the player view, and the other is a lifecycle observer so the host can tie that release to the activity or fragment's lifecycle. That design follows from the architecture: the library hands your app a custom view, and that view owns a WebView, and a WebView that is never destroyed keeps its resources and its context. The API surface reflects this too. There is an initialisation step, a set of options passed at that point, a full-screen mode, and a player object you get a reference to after the view reports ready, with a listener carrying a readiness callback and a state-change callback. Nothing about that is unusual for a view wrapper, but it does mean the integration has a lifecycle contract, and the fact that the contract is in the table of contents rather than in a migration guide tells you where to look when a screen leaks.

Two Chromecast modules, because the receiver is an app you host

Casting is not one feature here, it is two modules and five documented steps. The repository has a Chromecast sender library and, separately, a Chromecast receiver application, and the receiver table of contents includes a section on hosting it. That is the shape Google requires: casting to a television needs an application that runs on the television side and knows how to receive, and the page walks through downloading extra dependencies, the sender, the receiver, registration, and then hosting the receiver somewhere. So a team adopting the cast support is committing to deploying and maintaining a second application, on whatever hosting the vendor's receiver registration expects, in addition to the mobile app. For an app that only occasionally casts, that is a real cost, and it is the kind of thing the module list on the page does not convey.

Version thirteen, released in 2025, developed on a branch called dev

The repository's default branch is called dev rather than main or master, which tells you development happens somewhere other than the branch most tools assume. The release list shows a thirteenth major line from September 2025, preceded by a twelfth point one point two in June 2025 and a twelfth point one point one in September 2024. The repository itself was pushed in June 2026. So the newest published artefact is roughly eleven months older than the last change to the source, which for a library whose whole reason to exist is that the vendor deprecated the alternative means the gap matters: a vendor deprecation can force a migration, and there is no tagged release from 2026 to migrate to. The README also carries no changelog and the tree has none either, so the release notes are the only record of what changed in the major bump.

The page opens with an advertisement, and the only CI file is retired

Two things about the repository page itself. The first block above the project title is a commercial advertisement, delimited by explicit advertisement markers, promoting a service that replies to store reviews with generated text. It is above the heading and above the badges, so it is the first thing anyone reads, including anyone arriving from a search result. The second is in the tree: there is a continuous integration configuration for a service that stopped accepting new open source work, and no workflow directory alongside the repository's own community files. So the page says this library is used by thousands of applications and the build story is a service that no longer runs. Neither is a reason to avoid the library. Both are reasons to read the actual source rather than the badges, which is a habit worth having anyway when a project has been stable for a decade.

Editorial conclusion

This library suits an Android app that must play YouTube video after Google's own player library was deprecated, and that wants a normal Android view with lifecycle handling rather than a web view in its layout. Three things to check first. The terms of service answer is not unconditional: it depends on the app only playing while the player is visible, which the library handles if you follow the documented instructions. The player view has to be released explicitly, so treat that as part of integrating it rather than an afterthought. And the library is a wrapper, so every behaviour it offers is one the vendor's embed player exposes, plus a documented list of ways around the parts it does not, which is the section worth reading before you design around it.

Frequently asked questions

How to play YouTube videos in Android?

This repository's answer is that you embed the vendor's own browser-based player inside a WebView, which is what the vendor now recommends since its native player library was deprecated. The library wraps that WebView in a normal Android view, so you add it to a layout, initialise it with options, get a player reference once it reports ready, and load videos through a utility that accepts either a plain video identifier or a full URL. You must also release the view, ideally through the lifecycle observer it provides.

Why won't YouTube play on my Android?

The repository does not troubleshoot playback on the YouTube app or site; it documents embedding video in your own app. The one behaviour it warns about is playing while the player is not visible, which it says it handles for you if you follow the documented instructions. For anything else, the page points at its own API documentation, the sample apps, and a set of documented workarounds for things the embedded interface does not expose directly.

Does this library break YouTube's terms of service?

The page says no, because playback goes through YouTube's own web player in a WebView, which is the vendor-recommended approach on mobile. The answer is conditional though: the page says it matters how you use it, and that videos must only be played while the player is visible, which the library handles if you follow the documentation. It also advises making it obvious in your store listing that your app has no affiliation with YouTube, which it notes is unrelated to the library itself.

What does the Chromecast support require?

Two modules rather than one: a sender library and a receiver application. The documented steps are downloading extra dependencies, then setting up the sender, the receiver, registration, and hosting the receiver. So cast support means deploying and maintaining a second application on the television side in addition to the mobile app. The page also notes that casting requires internet access from the television, since the cast device fetches the stream itself.

How do I skip ads or change video quality in android-youtube-player?

Both are in the section the page calls workarounds, alongside logging into a YouTube account, removing interface elements the controls parameter will not remove, forcing subtitles to hide, and playing the next recommended video. Each is reached through the parameters the embedded player interface exposes rather than through a native player API, which is the honest framing: the wrapper offers what the interface allows plus documented ways around what it does not.

Official sources

  1. License: MIT
  2. PierfrancescoSoffritti/android-youtube-player on GitHub
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/pierfrancescosoffritti-android-youtube-player.svg)](https://hysenlabs.com/projects/pierfrancescosoffritti-android-youtube-player)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/pierfrancescosoffritti-android-youtube-player.svg)](https://hysenlabs.com/projects/pierfrancescosoffritti-android-youtube-player)

Was this useful?