toro icon indicating copy to clipboard operation
toro copied to clipboard

Autoplay youtube videos

Open brijhub opened this issue 7 years ago • 3 comments

Hi @eneim I have a list which has both basic video (.mp4) and Youtube videos. Basic video is playing properly but youtube videos are not playing. It just showing black screen.

Current version I'm using implementation 'im.ene.toro3:toro:3.4.2' implementation 'im.ene.toro3:toro-ext-exoplayer:3.4.2'

Layout file

<com.google.android.exoplayer2.ui.PlayerView
                                    android:id="@+id/video_view"
                                    android:layout_width="match_parent"
                                    android:layout_height="match_parent"
                                    app:surface_type="texture_view"
                                    app:resize_mode="fixed_width"
                                    app:use_controller="false"
                                    android:visibility="visible" />

Now my question is, You have already pushed app-youtube module in your repo but How can I add in my existing project and implement it so that I can able to play you tube videos as well into the list.

Can you provide the solution please ?

brijhub avatar May 29 '18 06:05 brijhub

@brijhub The power of Toro lies on Helper classes. In your case, you need 2 types of ViewHolder, one for mp4 videos and one for Youtube videos. Each type will work with one kind of Helpers and the code I push shows you how I designed the helper for Youtube videos.

You can combine them into one adapter to make it work for both mp4 and youtube :D. A lot of work I suppose, just let me know if you got what you need to do. Also, Youtube is not supported officially, so I can just do what I can, at lower priority than other features/issues.

eneim avatar May 29 '18 09:05 eneim

I'm still implementing this functionality. Thanks for your words. I let you know If I face any difficulties @eneim

brijhub avatar May 31 '18 09:05 brijhub

hi @brijhub @eneim , any working example on how to use two helper classes and viewholders?

fahmisdk6 avatar Jul 01 '18 05:07 fahmisdk6