Ionic Capacitor Cordova YouTube Video Player where to declare YouTubeDataApiKey in Android project

966 Views Asked by At

I am using latest Ionic, Capacitor, and Angular along with https://github.com/ihadeed/CordovaYoutubeVideoPlayer to play videos. This is working fine on iOS platform, but I cannot determine where to declare YouTubeDataApiKey in Android project, as required.

In documentation for non-Capacitor project it's defined as this: <preference name="YouTubeDataApiKey" value="[YOUR YOUTUBE API]" />

Any assistance is appreciated.

1

There are 1 best solutions below

2
On

Managed to get my Ionic Capacitor project working with cordova youtube video player

In Android project: Add <preference name="YouTubeDataApiKey" value="my_youtube_api_key" /> to app/src/main/res/xml/config.xml.

Add <string name="activity_name">my_bundle_id</string> to app/src/main/res/values/strings.xml.

Where my_bundle_id is like io.ionic.starter.