Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android YouTube API "An error occurred while initializing YouTube player"

I have an android app, which allows to play youtube video. I am using the latest YouTube API (1.2.1). I try it on a several devices within android version 4.0.4, 4.3, 4.4.4 or 5.0 and it works perfect (on every device is YouTube app version 10.-. But on one device, where is android 4.0.4 and YouTube app version 4.4.11 it does not work and get an error "An error occurred while initializing YouTube player". In documentation is written, that the minimal required version of YouTube app is 4.2.16. So I don't know, where is the problem.

Does somebody have an idea, what is wrong or how can I fix it?

Thanks a lot...

like image 848
pojta Avatar asked Mar 18 '15 22:03

pojta


People also ask

How do I fix an error occurred while initializing the YouTube player?

Update your Android youtube app to the latest version and it will work for Sure!!

How do I fix an error on YouTube android?

Restart the YouTube app. Restart your device: Do a hard restart by disconnecting the power and then reconnecting. For game consoles: Uninstall and reinstall the YouTube app. Update your device's firmware/system software.


1 Answers

This issues coming in Android 11 and above version, due to Package visibility filtering

The limited app visibility affects the return results of methods that give information about other apps, such as queryIntentActivities(), getPackageInfo(), and getInstalledApplications(). The limited visibility also affects explicit interactions with other apps, such as starting another app's service.

For more info : https://developer.android.com/training/package-visibility

Add the below lines of code into your AndroidManifest.xml file

<queries>
   <intent>
      <action android:name="com.google.android.youtube.api.service.START" />
   </intent>
</queries>
like image 84
Bilal Tariq Avatar answered Sep 22 '22 11:09

Bilal Tariq