Youtube Video Player not working on Android

#1

Hello everyone,

The plugin located here seems to not work for me on Android :

Indeed,
the plugin works fine on iOS, but I cannot launch the app in my Android Studio …

My config :

Installed platforms:
  android 7.0.0
  ios 4.5.4

I installed the plugin :

ionic cordova plugin add cordova-plugin-youtube-video-player
npm install --save @ionic-native/youtube-video-player

And for information, I added the plugin in my app module.

ionic cordova build android is working, but when I try to “Make Project” on Android Studio it failed :

[...my path ...]/platforms/android/app/src/main/java/com/bunkerpalace/cordova/YoutubeVideoPlayer.java
Error:(13, 41) error: package com.google.android.youtube.player does not exist
Error:(14, 25) error: package com.keyes.youtube does not exist
Error:(53, 21) error: cannot find symbol variable YouTubeIntents
Error:(54, 38) error: cannot find symbol variable YouTubeIntents
Error:(55, 14) error: cannot find symbol variable YouTubeIntents
Error:(57, 8) error: cannot find symbol variable YouTubeIntents
Error:(58, 15) error: cannot find symbol variable YouTubeIntents
Error:(71, 81) error: cannot find symbol class OpenYouTubePlayerActivity

Second part of errors : 
[...]/platforms/android/app/src/main/java/com/bunkerpalace/cordova/YouTubeActivity.java 
Error:(7, 41) error: package com.google.android.youtube.player does not exist
Error:(8, 41) error: package com.google.android.youtube.player does not exist
Error:(9, 41) error: package com.google.android.youtube.player does not exist
Error:(10, 55) error: package com.google.android.youtube.player.YouTubePlayer does not exist
Error:(11, 41) error: package com.google.android.youtube.player does not exist
Error:(12, 55) error: package com.google.android.youtube.player.YouTubePlayer does not exist
Error:(14, 38) error: cannot find symbol class YouTubeBaseActivity
Error:(14, 82) error: package YouTubePlayer does not exist
Error:(15, 9) error: cannot find symbol class PlayerStateChangeListener
Error:(18, 13) error: cannot find symbol class YouTubePlayerView
Error:(34, 41) error: cannot find symbol class Provider
Error:(34, 60) error: cannot find symbol class YouTubePlayer
Error:(42, 41) error: cannot find symbol class Provider
Error:(42, 60) error: cannot find symbol class YouTubeInitializationResult
Error:(59, 60) error: package com.google.android.youtube.player.YouTubePlayer does not exist
Error:(22, 5) error: method does not override or implement a method from a supertype
Error:(24, 9) error: cannot find symbol variable super
Error:(25, 25) error: cannot find symbol method getIntent()
Error:(28, 27) error: cannot find symbol class YouTubePlayerView
Error:(33, 5) error: method does not override or implement a method from a supertype
Error:(41, 5) error: method does not override or implement a method from a supertype
Error:(47, 18) error: no suitable method found for makeText(YouTubeActivity,String,int)
method Toast.makeText(Context,CharSequence,int) is not applicable
(argument mismatch; YouTubeActivity cannot be converted to Context)
method Toast.makeText(Context,int,int) is not applicable
(argument mismatch; YouTubeActivity cannot be converted to Context)
Error:(51, 5) error: method does not override or implement a method from a supertype
Error:(53, 19) error: cannot find symbol variable RESULT_OK
Error:(54, 9) error: cannot find symbol method finish()
Error:(57, 5) error: method does not override or implement a method from a supertype
Error:(61, 9) error: cannot find symbol method finish()
Error:(64, 5) error: method does not override or implement a method from a supertype
Error:(67, 5) error: method does not override or implement a method from a supertype
Error:(70, 5) error: method does not override or implement a method from a supertype
Error:(73, 5) error: method does not override or implement a method from a supertype

Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

Information:BUILD FAILED in 16s
Information:40 errors
Information:0 warnings

I really don’t know what to do with that,
Did anyone have this kind of troubles with the plugin ?

Thank you very much !

Théo.

#2

try Videogular 2

#3

Just the apposite. Works on Android, but not working on iOS. Can’t even get a decent error message from iOS :frowning: Just doesn’t work. Doesn’t do anything, when opening a link to video.

#4

Got the same error. Have you fixed it?

#5

No wasn’t able to fix it …
I decided to use InAppBrowser for now.
It work well but if I succeed to do it I’ll tell you !

#6

The information of native plugin says: “Plays YouTube videos in Native YouTube App”.
Now, only one simple (and stupid) question, did you try update your YouTube app? Considering that the ionic uses it for playing vídeos.

Other explanation: the native plugin is not updated to use updated Youtube app, open issue about this.

#8

Not a stupid question at all, on the contrary,
At the time I tried to used it, I had everything updated, but it’s definitely something I’ll give a try thanks.
Tells you if it works… (I’ll try this week I guess)

1 Like
#9

Has anyone figured this out yet? I ended up adding this plugin on github, which basically is a fork of the original plugin with changes to the plugin.xml file (in the plugin folder). It makes changes to the config tags so that the files are placed in the right folders when it builds.

Works just fine on iOS, but when I attempt to call its video function, I get this error:

D/PluginManager: exec() call to unknown plugin: YoutubeVideoPlayer

D/SystemWebChromeClient: http://localhost:8080/plugins/cordova-plugin-youtube-video-player/plugins/com.bunkerpalace.cordova.YoutubeVideoPlayer/www/YoutubeVideoPlayer.js: Line 14 : Class not found

I/chromium: [INFO:CONSOLE(14)] "Class not found", source: http://localhost:8080/plugins/cordova-plugin-youtube-video-player/plugins/com.bunkerpalace.cordova.YoutubeVideoPlayer/www/YoutubeVideoPlayer.js (14)

Still trying to figure it out myself, but I feel like I’m close.

If anyone has any suggestions, I’m all ears.

Thanks!

#10

waiting to hear update.