How do I access the cordova YouTube plugin?

Just to be clear, I’m NOT trying to embed a YouTube video.

I want to use this cordova plugin with the ionic app I’m working on:

I’ve pulled in a YouTube feed, put the entries into a list, and I’ve already configured the list item to return the YouTube video ID to the function in the controller.

I just can’t figure out how to access the plugin. I’ve tried several things, this is what my click event function looks like now:

$scope.playVideo = function(id) {
    //alert('Playing ' + id);

I know the plugin works because I built a very crude version of my app before I found Ionic, and it worked just fine… it was just really ugly.

This is my 3rd day messing with cordova, my second day messing with ionic, and my first day messing with angular js.

Any information is greatly appreciated.

Thank you.

Looking at the plugin site usage should just be:

Does that work for you? Is your click event being fired?

@dkarzon, Thank you for the reply, but no. That was the first thing I tried.

The YoutubeVideoPlayer class isn’t found, and I can’t figure out how to include it into the project so that it has the proper scope to be found, and executed.

you did run this command right? cordova plugin add com.bunkerpalace.cordova.youtubevideoplayer

@sjerd, Yes, I did.

I confirmed the files are in the plugins folder, and I also realized where my ignorance probably lies.

I’m working on my Windows machine. I don’t/can’t add the ios platform as a build option to this app in it’s current state.

I think I got a little carried away when I saw the Ionic View app, and everything worked fine up until the video player.

Let me try just accessing the plugin correctly, and I’ll launch the android emulator and see what happens.

Thank you for your responses.

@dkarzon & @sjerd Thank you for your replies. You helped to kick start my brain. I have resolved the problem.

Once I realized I was working in the wrong mobile platform. I revised my code to go back to the method stated in the plugin documentation, installed Genymotion, started an emulator, installed the apk, and it works.

$scope.playVideo = function(id) {

1 Like

@mariondorsett I use the same plugin and apparently there is a huge issue with Android 5.1, the plugin doesn’t work at all.

As you can see here :

And on the code the plugin is based, also :

So, if you have a solution for this, I would like to hear it !

1 Like

refer here: