exoplayer中的Recyclerview不起作用

时间:2019-09-08 10:52:49

标签: java android xml exoplayer android-framelayout

我让我的应用在框架布局内使用exo播放器,并且带有显示服务器列表的recyclerview,所以问题是当我单击播放器上的任何位置时,通常会隐藏诸如播放暂停进度条fullscrn之类的控件,因此recyclerview会崩溃,但应用崩溃但是如果我在单击播放器上的任何位置之前先单击recyclerview,则一切正常,就像recyclerview隐藏一样,就像exoplayer中的其他控件一样。

simpleExoPlayerView.setControllerVisibilityListener(new PlayerControlView.VisibilityListener() {
        @Override
        public void onVisibilityChange(int visibility) {
            Log.e("Visibil", String.valueOf(visibility));
            if (visibility==0){
                rvServer.setVisibility(VISIBLE);
                imgBack.setVisibility(VISIBLE);
                imgFull.setVisibility(VISIBLE);
                if (listSub.size()!=0) {
                    imgSubtitle.setVisibility(VISIBLE);
                }
            }else {
                rvServer.setVisibility(GONE);
                imgBack.setVisibility(GONE);
                imgFull.setVisibility(GONE);
                imgSubtitle.setVisibility(GONE);
            }
        }
    });



<FrameLayout
        android:id="@+id/player_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <com.google.android.exoplayer2.ui.PlayerView
            android:id="@+id/video_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:controller_layout_id="@layout/custom_controls"
            />
        <LinearLayout
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/rv_server_list"
            android:layout_width="match_parent"
            android:nestedScrollingEnabled="false"
            android:layout_height="wrap_content">
        </androidx.recyclerview.widget.RecyclerView>
        </LinearLayout>
        <com.google.android.exoplayer2.ui.SubtitleView
            android:id="@+id/subtitle"
            android:background="@color/transparent"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
        <ImageView
            android:id="@+id/img_subtitle"
            app:srcCompat="@drawable/ic_subtitle"
            android:layout_gravity="bottom|end"
            android:layout_marginBottom="42dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginEnd="50dp" />
    </FrameLayout>

'''错误日志

2019-09-09 09:37:26.318 21523-21523/com.demo.app E/vTYpe ::: 1
2019-09-09 09:37:30.392 21523-21523/com.demo.app E/STATE PLAYER:::: false
2019-09-09 09:37:44.515 21523-21523/com.demo.app E/Visibil: 8
2019-09-09 09:37:44.518 21523-21523/com.demo.app E/InputEventReceiver: Exception dispatching input event.
2019-09-09 09:37:44.518 21523-21523/com.demo.app E/MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback
2019-09-09 09:37:44.521 21523-21523/com.demo.app E/MessageQueue-JNI: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setVisibility(int)' on a null object reference
    at com.com.demo.app.DetailsActivity$11.onVisibilityChange(DetailsActivity.java:746)
    at com.google.android.exoplayer2.ui.PlayerControlView.hide(PlayerControlView.java:576)
    at com.google.android.exoplayer2.ui.PlayerView.onTouchEvent(PlayerView.java:798)
    at android.view.View.dispatchTouchEvent(View.java:10024)

0 个答案:

没有答案