Android Youtube Api Play Two Or More Youtube Players In One Main Activity
Using the Android Youtube api i want to play two videos in my app main activity without using fragment we have the same problem with this Multiple Youtube players in one activity
Solution 1:
Maybe trivial answer. But is for your use-case acceptable to call init of second youtube player from success callback of the first one? Have you tried it? It should be a reasonable workaround.
But there might be a catch that is extending YouTubeBaseActivity I looked up documentation, and it looks like there can be only one YouTubeView per activity because of binding between them.
So I can offer another advice, use YouTubePlayerFragment or SupportYouTubePlayerFragment instead. It should have its own lifecycle (not tested).
Solution 2:
To achieve two or more youtube players at one activity you need to use YouTubeThumbnailView(It is an ImageView) to show a list of preview images. When the user touch the thumb, you redirect to full screen video player.
Post a Comment for "Android Youtube Api Play Two Or More Youtube Players In One Main Activity"