Browse Source

feat: video 清晰度

tongmengxiao 3 months ago
parent
commit
b327079d2d

+ 14 - 1
.idea/deploymentTargetDropDown.xml

@@ -3,7 +3,20 @@
   <component name="deploymentTargetDropDown">
     <value>
       <entry key="app">
-        <State />
+        <State>
+          <targetSelectedWithDropDown>
+            <Target>
+              <type value="QUICK_BOOT_TARGET" />
+              <deviceKey>
+                <Key>
+                  <type value="VIRTUAL_DEVICE_PATH" />
+                  <value value="$USER_HOME$/.android/avd/Pixel_Fold_API_34.avd" />
+                </Key>
+              </deviceKey>
+            </Target>
+          </targetSelectedWithDropDown>
+          <timeTargetWasSelectedWithDropDown value="2024-07-18T02:04:41.635213Z" />
+        </State>
       </entry>
     </value>
   </component>

+ 1 - 1
.idea/kotlinc.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
   <component name="KotlinJpsPluginSettings">
-    <option name="version" value="1.7.10" />
+    <option name="version" value="1.9.0" />
   </component>
 </project>

+ 8 - 0
room/src/main/java/com/swago/room/anchor/AnchorRoomActivity.kt

@@ -68,6 +68,7 @@ import io.agora.capture.video.camera.Constant
 import java.util.*
 import com.swago.room.wishgift.SetWishGiftsDialog
 import io.agora.rtc.IRtcEngineEventHandler
+import io.agora.rtc.video.VideoEncoderConfiguration
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.launch
 
@@ -402,6 +403,13 @@ class AnchorRoomActivity : AbsAnchorActivity<ActivityAnchorRoomBinding, IRoomInf
             binding.cbPassword.text = if (isChecked)  getString(R.string.lock_room_on) else getString(R.string.lock_room_off)
             checkPassword = isChecked
         }
+        binding.cbClarity.setOnCheckedChangeListener { _, isChecked ->
+            if (isChecked){
+                AgoraManager.setVideoConfiguration(VideoEncoderConfiguration.VD_960x720 ,VideoEncoderConfiguration.FRAME_RATE.FRAME_RATE_FPS_15)
+            } else{
+                AgoraManager.setVideoConfiguration()
+            }
+        }
 
     }
 

+ 98 - 0
room/src/main/java/com/swago/room/dialog/ClarityVideoDialog.kt

@@ -0,0 +1,98 @@
+package com.swago.room.dialog
+
+import android.annotation.SuppressLint
+import android.os.Bundle
+import android.view.Gravity
+import android.view.View
+import com.bumptech.glide.Glide
+import com.swago.baseswago.baseroom.SwagoRoomManager
+import com.swago.baseswago.dialog.BaseXDFragment
+import com.swago.baseswago.model.live.AnchorClosedModel
+import com.swago.baseswago.util.NoDoubleClickListener
+import com.swago.baseswago.util.TimeUtil
+import com.swago.room.R
+import com.swago.room.databinding.DialogAnchorCloseBinding
+import com.swago.room.enum.RoomType
+
+/**
+ *@date 2021/11/28 21:13
+ *description:
+ */
+class ClarityVideoDialog : BaseXDFragment<DialogAnchorCloseBinding>(){
+
+    private var anchorCloseModel:AnchorClosedModel? = null
+    private var roomType:Int = 1
+
+    companion object{
+        fun newInstance(anchorCloseModel:AnchorClosedModel ,roomType: Int , checkPassword: Boolean):ClarityVideoDialog{
+            val dialog = ClarityVideoDialog()
+            val bundle = Bundle()
+            bundle.putParcelable("model",anchorCloseModel)
+            bundle.putInt("roomType",roomType)
+            bundle.putBoolean("checkPassword",checkPassword)
+            dialog.arguments = bundle
+            return dialog
+        }
+    }
+
+
+    @SuppressLint("MissingSuperCall")
+    override fun onActivityCreated(savedInstanceState: Bundle?) {
+        super.onActivityCreated(savedInstanceState)
+        setDimAmount(0f)
+        setHeightMatchParent()
+        setGravity(Gravity.BOTTOM)
+    }
+
+
+    override fun initOther() {
+        arguments?.let {
+            anchorCloseModel =  it.getParcelable("model")
+            roomType = it.getInt("roomType")
+            val checkPassword = it.getBoolean("checkPassword")
+            if (checkPassword){
+                binding.tvPassword.visibility = View.VISIBLE
+            } else {
+                binding.tvPassword.visibility = View.GONE
+            }
+            if (roomType == RoomType.VIDEO.type){
+                binding.tvIncome.text = getString(R.string.income_of_this_live)
+                binding.tvTime.text = getString(R.string.duration_of_this_live)
+                binding.tvTotalTime.text = getString(R.string.today_video_duration)
+                binding.tvWeekTime.text = getString(R.string.total_video_duration_this_week)
+                binding.tvWeekDayTime.text = getString(R.string.video_valid_days_this_week)
+            } else {
+                binding.tvIncome.text = getString(R.string.income_of_this_audio)
+                binding.tvTime.text = getString(R.string.duration_of_this_audio)
+                binding.tvTotalTime.text = getString(R.string.today_audio_duration)
+                binding.tvWeekTime.text = getString(R.string.total_voice_time_this_week)
+                binding.tvWeekDayTime.text = getString(R.string.voice_valid_days_this_week)
+            }
+
+            anchorCloseModel?.let {  anchorClosedModel ->
+                Glide.with(this).load(anchorClosedModel.user_head_img_url)
+                    .placeholder(R.mipmap.default_avatar)
+                    .error(R.mipmap.default_avatar).into(binding.ivAvatar)
+                binding.tvIncomeValue.text = anchorClosedModel.income_coins
+                binding.tvWatcherValue.text = anchorClosedModel.total_member
+                binding.tvTimeValue.text = TimeUtil.convertMinSecond((anchorClosedModel.broadcast_time))
+                binding.tvTotalTimeValue.text = TimeUtil.convertMinSecond((anchorClosedModel.today_total_time))
+                binding.tvWeekTimeValue.text = TimeUtil.convertMinSecond((anchorClosedModel.week_total_time ))
+                binding.tvWeekDayValue.text = "${anchorClosedModel.week_valid_day}"
+                binding.tvName.text = anchorClosedModel.user_name
+                binding.tvId.text = "ID:${anchorClosedModel.user_account}"
+            }
+        }
+
+        binding.tvClose.setOnClickListener(object : NoDoubleClickListener() {
+            override fun onClick() {
+                dismissAllowingStateLoss()
+                activity?.finish()
+            }
+        })
+    }
+
+    override fun initLiveData() {
+
+    }
+}

+ 6 - 0
room/src/main/res/drawable/live_clarity_check.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:drawable="@mipmap/ic_clarity_hd" android:state_checked="true"/>
+ <item android:drawable="@mipmap/ic_clarity_sd" android:state_checked="false"/>
+ <item android:drawable="@mipmap/ic_clarity_sd"/>
+</selector>

+ 16 - 0
room/src/main/res/layout/activity_anchor_room.xml

@@ -158,6 +158,22 @@
                 android:drawablePadding="4dp"
                 android:gravity="center_horizontal"
                 android:background="@android:color/transparent"
+                android:layout_marginEnd="16dp"
+                android:layout_marginBottom="24dp"/>
+
+            <CheckBox
+                android:id="@+id/cbClarity"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:drawableTop="@drawable/live_clarity_check"
+                android:textColor="#ffffff"
+                android:textSize="14dp"
+                android:button="@null"
+                android:layout_marginTop="3dp"
+                android:text="@string/lock_room_off"
+                android:drawablePadding="4dp"
+                android:gravity="center_horizontal"
+                android:background="@android:color/transparent"
                 android:layout_marginBottom="24dp"/>
 
         </LinearLayout>

BIN
room/src/main/res/mipmap-xxhdpi/ic_clarity_hd.png


BIN
room/src/main/res/mipmap-xxhdpi/ic_clarity_sd.png