Przeglądaj źródła

1.优化视频播放页面UI

王鹏鹏 2 lat temu
rodzic
commit
3c24f355cf

+ 1 - 0
.idea/misc.xml

@@ -630,6 +630,7 @@
         <entry key="..\:/workspace/hcp-pads/push/src/main/res/layout/item_push_list.xml" value="0.23697916666666666" />
         <entry key="..\:/workspace/hcp-pads/push/src/main/res/layout/item_push_type.xml" value="0.23697916666666666" />
         <entry key="..\:/workspace/hcp-pads/superplayerkit/src/main/res/drawable/superplayer_shape_round_bg.xml" value="0.1415" />
+        <entry key="..\:/workspace/hcp-pads/superplayerkit/src/main/res/layout/superplayer_item_for_custom_spinner.xml" value="0.23697916666666666" />
         <entry key="..\:/workspace/hcp-pads/superplayerkit/src/main/res/layout/superplayer_vod_player_fullscreen.xml" value="0.1" />
         <entry key="..\:/workspace/hcp-pads/superplayerkit/src/main/res/layout/superplayer_vod_player_window.xml" value="0.23697916666666666" />
         <entry key="..\:/workspace/hcp-pads/superplayerkit/src/main/res/layout/superplayer_vod_view.xml" value="0.1" />

+ 17 - 1
livebroadcast/src/main/java/com/yingyang/livebroadcast/activity/video/VideoPlayerActivity.kt

@@ -1,11 +1,12 @@
 package com.yingyang.livebroadcast.activity.video
 
 import android.annotation.SuppressLint
-import android.os.Bundle
 import android.view.MotionEvent
 import android.view.View
 import com.alibaba.android.arouter.facade.annotation.Route
+import com.tencent.liteav.demo.superplayer.SuperPlayerGlobalConfig
 import com.tencent.liteav.demo.superplayer.SuperPlayerModel
+import com.tencent.rtmp.TXLiveConstants
 import com.yingyang.livebroadcast.R
 import com.yingyang.livebroadcast.databinding.ActivityVideoPlayerBinding
 import com.yingyangfly.baselib.base.BaseActivity
@@ -31,6 +32,7 @@ class VideoPlayerActivity : BaseActivity<ActivityVideoPlayerBinding>(), View.OnT
         } else {
             videoUrl
         }
+        initSuperVodGlobalSetting()
         binding {
             tvTitle.text = title
             val model = SuperPlayerModel()
@@ -50,6 +52,20 @@ class VideoPlayerActivity : BaseActivity<ActivityVideoPlayerBinding>(), View.OnT
     override fun initData() {
     }
 
+    /**
+     * 初始化超级播放器全局配置
+     */
+    private fun initSuperVodGlobalSetting() {
+        val prefs = SuperPlayerGlobalConfig.getInstance()
+        // 开启悬浮窗播放
+        prefs.enableFloatWindow = false
+        prefs.enableLog = false
+        prefs.enablePIP = false
+        prefs.mute = false
+        // 设置播放器渲染模式
+        prefs.renderMode = TXLiveConstants.RENDER_MODE_ADJUST_RESOLUTION
+    }
+
     override fun onDestroy() {
         binding.playTxCloudView.resetPlayer()
         super.onDestroy()

+ 1 - 0
livebroadcast/src/main/res/values/colors.xml

@@ -19,4 +19,5 @@
     <color name="transparent" tools:ignore="ResourceName">#00000000</color><!-- 透明   -->
     <color name="color_80BFDAFF" tools:ignore="ResourceName">#80BFDAFF</color>
     <color name="color_960DA346" tools:ignore="ResourceName">#960DA346</color>
+    <color name="color_FF000000" tools:ignore="ResourceName">#FF000000</color>
 </resources>

+ 1 - 1
superplayerkit/src/main/java/com/tencent/liteav/demo/superplayer/SuperPlayerGlobalConfig.java

@@ -28,7 +28,7 @@ public class SuperPlayerGlobalConfig {
     /**
      * 默认播放填充模式 ( 默认播放模式为 自适应模式 )
      */
-    public int renderMode = TXLiveConstants.RENDER_ROTATION_LANDSCAPE;
+    public int renderMode = TXLiveConstants.RENDER_MODE_ADJUST_RESOLUTION;
 
     /**
      * 播放器最大缓存个数。

+ 0 - 2
superplayerkit/src/main/java/com/tencent/liteav/demo/superplayer/SuperPlayerView.java

@@ -197,11 +197,9 @@ public class SuperPlayerView extends RelativeLayout
         mSuperPlayer.setSubTitleView(mSubtitleView);
         mSuperPlayer.switchPlayMode(SuperPlayerDef.PlayerMode.FULLSCREEN);
         if (mSuperPlayer.getPlayerMode() == SuperPlayerDef.PlayerMode.FULLSCREEN) {
-            Log.e("wpp", "----------------------FULLSCREEN");
             addView(mFullScreenPlayer);
             mFullScreenPlayer.hide();
         } else if (mSuperPlayer.getPlayerMode() == SuperPlayerDef.PlayerMode.WINDOW) {
-            Log.e("wpp", "----------------------WINDOW");
             addView(mWindowPlayer);
             mWindowPlayer.hide();
         }

+ 7 - 7
superplayerkit/src/main/java/com/tencent/liteav/demo/superplayer/ui/player/FullScreenPlayer.java

@@ -124,7 +124,7 @@ public class FullScreenPlayer extends AbsPlayer implements View.OnClickListener,
     private float                          mWaterMarkBmpX;                         // 水印x坐标
     private float                          mWaterMarkBmpY;                         // 水印y坐标
     private boolean                        mBarrageOn;                             // 弹幕是否开启
-    private boolean                        mLockScreen;                            // 是否锁屏
+    private boolean                        mLockScreen = true;                            // 是否锁屏
     private TXImageSprite                  mTXImageSprite;                         // 雪碧图信息
     private List<PlayKeyFrameDescInfo>     mTXPlayKeyFrameDescInfoList;            // 关键帧信息
     private int                            mSelectedPos      = -1;                      // 点击的关键帧时间点
@@ -180,7 +180,7 @@ public class FullScreenPlayer extends AbsPlayer implements View.OnClickListener,
 
             @Override
             public boolean onSingleTapConfirmed(MotionEvent e) {
-                toggle();
+//                toggle();
                 return true;
             }
 
@@ -422,7 +422,7 @@ public class FullScreenPlayer extends AbsPlayer implements View.OnClickListener,
                 }
             }
         } else {
-//            mIvLock.setVisibility(VISIBLE);
+            mIvLock.setVisibility(VISIBLE);
             if (mHideLockViewRunnable != null) {
                 removeCallbacks(mHideLockViewRunnable);
                 postDelayed(mHideLockViewRunnable, 7000);
@@ -492,7 +492,7 @@ public class FullScreenPlayer extends AbsPlayer implements View.OnClickListener,
         if (mHideLockViewRunnable != null) {
             removeCallbacks(mHideLockViewRunnable);
         }
-//        mIvLock.setVisibility(VISIBLE);
+        mIvLock.setVisibility(VISIBLE);
         if (mPlayType == SuperPlayerDef.PlayerType.LIVE_SHIFT) {
             if (mLayoutBottom.getVisibility() == VISIBLE)
                 mTvBackToLive.setVisibility(View.VISIBLE);
@@ -939,7 +939,7 @@ public class FullScreenPlayer extends AbsPlayer implements View.OnClickListener,
      */
     private void toggleLockState() {
         mLockScreen = !mLockScreen;
-//        mIvLock.setVisibility(VISIBLE);
+        mIvLock.setVisibility(VISIBLE);
         if (mHideLockViewRunnable != null) {
             removeCallbacks(mHideLockViewRunnable);
             postDelayed(mHideLockViewRunnable, 7000);
@@ -1200,12 +1200,12 @@ public class FullScreenPlayer extends AbsPlayer implements View.OnClickListener,
 
     public void setVodSelectionViewPositionAndData(List<TXTrackInfo> models) {
         mVodSoundTrackView.setModelList(models);
-//        mIvSoundTrack.setVisibility(models.size() == 0 ? GONE : VISIBLE);
+        mIvSoundTrack.setVisibility(models.size() == 0 ? GONE : VISIBLE);
     }
 
     public void setVodSubtitlesViewPositionAndData(List<TXTrackInfo> models) {
         mVodSubtitlesView.setModelList(models);
-//        mIvSubtitle.setVisibility(models.size() == 0 ? GONE : VISIBLE);
+        mIvSubtitle.setVisibility(models.size() == 0 ? GONE : VISIBLE);
     }
 
     /**

+ 1 - 2
superplayerkit/src/main/java/com/tencent/liteav/demo/superplayer/ui/view/VodMoreView.java

@@ -9,6 +9,7 @@ import android.content.IntentFilter;
 import android.media.AudioManager;
 import android.provider.Settings;
 import android.util.AttributeSet;
+import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.Window;
@@ -104,8 +105,6 @@ public class VodMoreView extends RelativeLayout implements RadioGroup.OnCheckedC
         mSwitchAccelerate.setOnCheckedChangeListener(this);
 
         mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
-        mAudioManager.setMode(AudioManager.MODE_NORMAL);
-        mAudioManager.setSpeakerphoneOn(true);
         updateCurrentVolume();
         updateCurrentLightProgress();
     }

+ 2 - 6
superplayerkit/src/main/res/layout/superplayer_vod_player_fullscreen.xml

@@ -28,7 +28,7 @@
                 android:layout_gravity="center_vertical"
                 android:layout_marginLeft="20dp"
                 android:gravity="right"
-                android:visibility="gone"
+                android:visibility="visible"
                 android:src="@drawable/superplayer_multi_audio"/>
 
             <ImageView
@@ -38,7 +38,7 @@
                 android:layout_gravity="center_vertical"
                 android:layout_marginLeft="20dp"
                 android:gravity="right"
-                android:visibility="gone"
+                android:visibility="visible"
                 android:src="@drawable/superplayer_multi_subtitle"/>
 
             <ImageView
@@ -58,7 +58,6 @@
                 android:layout_gravity="center_vertical"
                 android:layout_marginLeft="20dp"
                 android:gravity="right"
-                android:visibility="gone"
                 android:src="@drawable/superplayer_ic_danmuku_off" />
 
             <ImageView
@@ -68,7 +67,6 @@
                 android:layout_gravity="center_vertical"
                 android:layout_marginLeft="20dp"
                 android:gravity="right"
-                android:visibility="gone"
                 android:src="@drawable/superplayer_ic_vod_snapshot_normal" />
 
             <ImageView
@@ -79,7 +77,6 @@
                 android:layout_marginLeft="20dp"
                 android:layout_marginRight="20dp"
                 android:gravity="right"
-                android:visibility="gone"
                 android:src="@drawable/superplayer_ic_vod_more_normal" />
 
         </LinearLayout>
@@ -293,7 +290,6 @@
             android:layout_height="wrap_content"
             android:layout_gravity="center_vertical"
             android:layout_marginLeft="20dp"
-            android:visibility="gone"
             android:src="@drawable/superplayer_btn_back_play" />
 
         <TextView

+ 16 - 19
superplayerkit/src/main/res/layout/superplayer_vod_player_window.xml

@@ -11,16 +11,15 @@
         android:layout_height="@dimen/superplayer_media_controller_view_height"
         android:background="@drawable/superplayer_top_shadow"
         android:gravity="left"
-        android:orientation="horizontal"
-        android:paddingLeft="20dp">
+        android:paddingLeft="20dp"
+        android:orientation="horizontal">
 
         <ImageView
             android:id="@+id/superplayer_iv_back"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_gravity="center_vertical"
-            android:src="@drawable/superplayer_btn_back_play"
-            android:visibility="gone" />
+            android:src="@drawable/superplayer_btn_back_play" />
 
         <TextView
             android:id="@+id/superplayer_tv_title"
@@ -45,17 +44,17 @@
         android:visibility="gone">
 
         <ImageView
+            android:tint="@color/superplayer_white"
             android:layout_width="25dp"
             android:layout_height="25dp"
-            android:src="@drawable/superplayer_ic_replay"
-            android:tint="@color/superplayer_white" />
+            android:src="@drawable/superplayer_ic_replay" />
 
         <TextView
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:text="@string/superplayer_replay"
             android:textColor="@color/superplayer_white"
-            android:textSize="12sp" />
+            android:text="@string/superplayer_replay"
+            android:textSize="12sp"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"/>
 
     </LinearLayout>
 
@@ -99,8 +98,8 @@
     <ImageView
         android:id="@+id/superplayer_cover_view"
         android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:visibility="gone" />
+        android:visibility="gone"
+        android:layout_height="match_parent" />
 
     <LinearLayout
         android:id="@+id/superplayer_ll_bottom"
@@ -150,18 +149,17 @@
             android:layout_height="wrap_content"
             android:layout_gravity="center_vertical"
             android:text="00:00"
-            android:paddingEnd="12dp"
             android:textColor="@android:color/white"
             android:textSize="11.0sp" />
 
         <ImageView
             android:id="@+id/superplayer_iv_play_next"
+            android:visibility="gone"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_centerInParent="true"
             android:layout_gravity="center_vertical"
-            android:src="@drawable/superplayer_play_next"
-            android:visibility="gone" />
+            android:src="@drawable/superplayer_play_next"/>
 
         <ImageView
             android:id="@+id/superplayer_iv_fullscreen"
@@ -169,8 +167,7 @@
             android:layout_height="wrap_content"
             android:layout_centerInParent="true"
             android:layout_gravity="center_vertical"
-            android:src="@drawable/superplayer_ic_vod_fullscreen"
-            android:visibility="gone" />
+            android:src="@drawable/superplayer_ic_vod_fullscreen" />
     </LinearLayout>
 
     <ProgressBar
@@ -200,6 +197,6 @@
         android:layout_alignParentRight="true"
         android:layout_centerVertical="true"
         android:layout_marginRight="10dp"
-        android:src="@drawable/superplayer_pip_play_icon"
-        android:visibility="gone" />
+        android:visibility="gone"
+        android:src="@drawable/superplayer_pip_play_icon" />
 </RelativeLayout>

+ 1 - 1
superplayerkit/src/main/res/layout/superplayer_vod_vipwatch_view.xml

@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:orientation="vertical">
@@ -50,7 +51,6 @@
             android:layout_height="@dimen/superplayer_media_controller_view_height"
             android:layout_gravity="center_vertical"
             android:layout_marginLeft="20dp"
-            android:visibility="gone"
             android:src="@drawable/superplayer_btn_back_play" />