I tried to add in our androidx app the last Youtube Player for Publishers v2.1.2.
To add this player we must create a new instance of YoutubeEmbedFragment extends Fragment
.
The problem here is that this Fragment extends android.app.Fragment
and in our application we use androidx.appcompat.app.AppCompatActivity
and androidx.fragment.app
so when I want to add this Youtube player fragment like :
getChildFragmentManager()
.beginTransaction()
.replace(R.id.player_container, youTubeEmbedFragment)
.commit();
It won't compile because of
Wrong 2nd argument type. Found: 'com.google.android.youtube.player.YouTubeEmbedFragment', required: 'androidx.fragment.app.Fragment'
How can we stay using support fragment but also use the library ?