YouTubeAndroidPlayerApi library plays YouTube videos without a real GCP Api key

Viewed 34

I am using the YouTubeAndroidPlayerApi library to show a YouTube video playback in my Android application. (Specification-Version: 1.2.2)

gradle dependency:

implementation files('libs/YouTubeAndroidPlayerApi.jar')

I noticed some strange behavior with the library. The documentation says that you need to use the API key created in the GCP Console.

But during testing it turned out that the video is played without a real key. Below is an example test:

Test 1. I'm using the wrong or random API key:

val API_KEY = "QWERTYUIDFGHJKL" // wrong or random API key
YouTubePlayerSupportFragment.newInstance().initialize(API_KEY, object : YouTubePlayer.OnInitializedListener {...})

Surprisingly video video is played with this api_key.

Test 2. I use empty string instead of API key:

val API_KEY = "" // empty API key
YouTubePlayerSupportFragment.newInstance().initialize(API_KEY, object : YouTubePlayer.OnInitializedListener {...})

Video is playing in my app with this code

Can you please tell me why the video plays without a real GCP API key?

0 Answers
Related