I am trying to use Youtube Player in my android app. It is showing a old outdated UI for the player but in the samples its showing a modern UI. The only difference between the two apps is I am using YoutubePlayerSupportFragment instead of YoutubePlayerFragment. This is because i am using AppCompatActivity for Material Theme in pre lollipop devices.
I am getting the below statement in logs:
W/YouTubeAndroidPlayerAPI﹕ Cannot load modern controls UI. Upgrade to the latest version of the Android YouTube API.
How to overcome this problem ? I need the modern UI using Appcompat and YoutubePlayerSupportFragment
I found something that worked for me.
Set this before super.OnCreate() in the Activity your fragment is currently on:
getLayoutInflater().setFactory(this);
My guess is that the YouTube APIs have yet to be updated.
Consider this:
View
s that link to the official YouTube application, that needs to be installed on the device for it to workFragment
s are natively supportedYouTubePlayerFragment
, but not with YouTubePlayerSupportFragment
I believe that the YouTube 'SDK' can directly import the player view from the YouTube app, taking advantage of the modern UI controls. However, support Fragment
s require more actions on the SDK side, actions which are yet to be taken in the form of an update.
TL;DR
Your best bet is waiting for the YouTube APIs to be updated to a newer version.
EDIT
Looks like the YouTube SDK has just been updated to 1.2.2! Head over here to download it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With