linsea / UniversalVideoView

A better Android VideoView with more Media Controller customization. 一个更好用的Android VideoView
https://github.com/linsea/UniversalVideoView
992 stars 272 forks source link

Is it possible to set up a click or touch event for a UniversalVideoView ? #65

Open BoumBam opened 4 years ago

BoumBam commented 4 years ago

I want to handle the click or touch event for the UniversalVideoView. I tried the below:

`

    <FrameLayout
        android:id="@+id/video_layout"
        android:layout_width="0dp"
        android:layout_height="200dp"
        android:background="@android:color/black"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <com.universalvideoview.UniversalVideoView
            android:id="@+id/videoView"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_gravity="center"
            app:uvv_autoRotation="true"
            app:uvv_fitXY="false" />

        <com.universalvideoview.UniversalMediaController
            android:id="@+id/media_controller"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            app:uvv_scalable="true" />

    </FrameLayout>

videoView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(ImgVideoViewerActivity.this, "bien", Toast.LENGTH_SHORT).show();
            }
        });

        video_layout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(ImgVideoViewerActivity.this, "bien", Toast.LENGTH_SHORT).show();
            }
        });`

Bbut not work.

Thanks.