视频组件优化

This commit is contained in:
2026-05-30 17:36:10 +08:00
parent ed9d05cb42
commit 5cda6d959e
9 changed files with 104 additions and 22 deletions

View File

@@ -53,7 +53,7 @@ class AlarmLogActivity : AppCompatActivity() {
setContentView(binding.root)
ImmersionBar.with(this)
.statusBarDarkFont(true)
.titleBar(binding.exoPlayContextId)
.transparentStatusBar()
.init()
deviceId = intent.getStringExtra("device_id")
@@ -128,11 +128,15 @@ class AlarmLogActivity : AppCompatActivity() {
val playerView = findPlayerView(binding.exoPlayContextId)
playerView?.setControllerVisibilityListener { visibility ->
if (visibility == View.VISIBLE) {
binding.ivBack.visibility = View.VISIBLE
binding.muteBar.visibility = View.VISIBLE
binding.functionBar.visibility = View.VISIBLE
binding.ivDownload.visibility = View.VISIBLE
binding.ivDelete.visibility = View.VISIBLE
} else {
binding.ivBack.visibility = View.GONE
binding.muteBar.visibility = View.GONE
binding.functionBar.visibility = View.GONE
binding.ivDownload.visibility = View.GONE
binding.ivDelete.visibility = View.GONE
}
}
}
@@ -255,6 +259,10 @@ class AlarmLogActivity : AppCompatActivity() {
}
private fun initListener() {
binding.ivBack.setOnClickListener {
finish()
}
binding.expandImg.setOnClickListener {
showDatePicker()
}

View File

@@ -31,6 +31,7 @@ import androidx.activity.OnBackPressedCallback
import chuangyuan.ycj.videolibrary.listener.VideoInfoListener
import chuangyuan.ycj.videolibrary.video.VideoPlayerManager
import android.view.View
import com.bumptech.glide.Glide
class LiveVideoActivity : BaseActivity() {
private lateinit var binding: LiveVideoActivityBinding
@@ -291,11 +292,9 @@ class LiveVideoActivity : BaseActivity() {
isVoiceEnabled = !isVoiceEnabled
if (isVoiceEnabled) {
binding.ivVoice.setImageResource(com.example.defenseapplication.R.drawable.voice_on_open)
Toast.makeText(this, R.string.sound_on, Toast.LENGTH_SHORT).show()
Glide.with(this).asGif().load(com.example.defenseapplication.R.drawable.voice_on_open).into(binding.ivVoice)
} else {
binding.ivVoice.setImageResource(com.example.defenseapplication.R.drawable.voice)
Toast.makeText(this, R.string.sound_off, Toast.LENGTH_SHORT).show()
}
}
@@ -304,10 +303,8 @@ class LiveVideoActivity : BaseActivity() {
if (isLightOn) {
binding.ivLight.setImageResource(com.example.defenseapplication.R.drawable.light_on_open)
Toast.makeText(this, R.string.light_on, Toast.LENGTH_SHORT).show()
} else {
binding.ivLight.setImageResource(com.example.defenseapplication.R.drawable.light_on)
Toast.makeText(this, R.string.light_off, Toast.LENGTH_SHORT).show()
}
}
@@ -341,12 +338,10 @@ class LiveVideoActivity : BaseActivity() {
binding.llAlarmLog.visibility = View.GONE
binding.consoleBar.visibility = View.VISIBLE
binding.ivVoice.setImageResource(com.example.defenseapplication.R.drawable.voice_on_open)
Glide.with(this).asGif().load(com.example.defenseapplication.R.drawable.voice_on_open).into(binding.ivVoice)
isVoiceEnabled = true
startVoiceRecording()
Toast.makeText(this, R.string.start_control_mode, Toast.LENGTH_SHORT).show()
}
private fun stopRecordingMode() {
@@ -361,8 +356,6 @@ class LiveVideoActivity : BaseActivity() {
stopVoiceRecording()
stopMicPulseAnimation()
Toast.makeText(this, R.string.stop_control_mode, Toast.LENGTH_SHORT).show()
}
private fun stopMicPulseAnimation() {