Android-youtube-player: YoutubePlayerView cannot be casted to LifeCycleObserver // Cannot Resolve Symbol "WebviewYoutubePlayer"

Created on 13 Nov 2018  路  12Comments  路  Source: PierfrancescoSoffritti/android-youtube-player

I faced this error
"java.lang.RuntimeException: Unable to start activity ComponentInfo{com.za4tech.android.customyoutube/com.za4tech.android.customyoutube.MainActivity}: java.lang.ClassCastException: com.pierfrancescosoffritti.androidyoutubeplayer.player.YouTubePlayerView cannot be cast to android.arch.lifecycle.LifecycleObserver"
when i went to check YoutubePlayerView implementations I found "Canon resolve symbol 'WebviewYoutubePlayer'" error is the culprit. But now I have no idea how to solve this. Please Help

error

question

Most helpful comment

Use the PlayerUIController. It's all in the doc.

All 12 comments

Which version of the library are you using?

Which version of the library are you using?

9.0.0
"implementation 'com.pierfrancescosoffritti.androidyoutubeplayer:core:9.0.0'"

Do you have the same problem with 8.0.1?

NO, Now the Issue is totally solved.
Thanks a Lot Friend

Ok, I guess you are still using the old support libraries. To use version 9+ you need to be using the androidx libraries.

The library doesn't handle full screen. It's up to you. I suggest you look at how it's done in the sample app.

The library doesn't handle full screen. It's up to you. I suggest you look at how it's done in the sample app.

Sorry for disturbing friend. I have resolved the issue and Thanks a lot for helping me out. I will never forget your help.

You're welcome, feel free to leave a star to the library on GitHub.

You're welcome, feel free to leave a star to the library on GitHub.

Already Done Friend. but Friend where have you handle the toolbar.I need to remove the toolbar settings otherwise if I am selecting NoTitleBar.Fullscreen theme the app get crashed.

Use a NoActionBar style if you want to remove the toolbar.

Use a NoActionBar style if you want to remove the toolbar.

Yes!! It has worked. thanks again mate. Friend, one last one please. Can we remove the youtube button from the player?

Use the PlayerUIController. It's all in the doc.

Was this page helpful?
0 / 5 - 0 ratings