liquid.pizza
liquid.pizza

Reputation: 525

Play a Youtube video in a fragment

I am working on an app. This app uses a Master-/Detail-View.

After selecting an video in the Master-View I want to play a video in the Detail-View. Currently I focus on the tablet version, which means, I want to play a yt-video in the detail-fragment.

How can I do this?

//edit: The default code uses getSupportFragmentManager() and I tried to put a normal YouTubePlayerFragment. Either use getFragmentManager() or use YouTubePlayerSupportFragment. This fixed my issue.

Upvotes: 2

Views: 1364

Answers (1)

jos
jos

Reputation: 1070

The youtube API provides the YoutubePlayerFragment to play youtube video in a fragment.

Also, Youtube API provides the YouTubePlayerSupportFragment based on android.support.v4.app.Fragment to earlier versions.

Hope this helps!

Upvotes: 2

Related Questions