Search code examples
androidvideoyoutubeandroid-youtube-api

Is there any way to play two youtube videos in one screen at the same time?


I have an activity and want to embed there two youtube players and allow user to play both at the same time.

I need this functionality to allow user to compare two videos.

But, I can't achieve this. When i press on play button in one video, the second video is stopped.

I already tried to use Activity with two youtube fragments in layout, activity with two youtube players in layout, activity with two webviews in layout where i use youtube iFrame, but all time I have the same result - only one playing video.

Also, I found that youtube api have limitation to one video. Any workaround to play two video on one screen at the same time?


Solution

  • Yes, you cannot run more than one instance of the YouTube view

    https://github.com/flipkart-incubator/inline-youtube-view. This is a suite of utility libraries around using YouTube inside your Android, iOS or React Native app.

    It has support to play multiple inline youtube videos in a fragment.