|
@@ -6,13 +6,16 @@ import android.os.Looper
|
|
|
import android.os.SystemClock
|
|
|
import android.util.Log
|
|
|
import android.view.View
|
|
|
+import android.widget.SeekBar
|
|
|
import com.alibaba.android.vlayout.VirtualLayoutManager
|
|
|
import com.alibaba.fastjson.JSONObject
|
|
|
import com.google.gson.Gson
|
|
|
import com.wdkl.ncs.android.component.nursehome.R
|
|
|
import com.wdkl.ncs.android.component.nursehome.adapter.BedItemAdapter
|
|
|
+import com.wdkl.ncs.android.component.nursehome.settingconfig.SettingConfig
|
|
|
import com.wdkl.ncs.android.middleware.common.Constants
|
|
|
import com.wdkl.ncs.android.component.nursehome.util.RingPlayHelper
|
|
|
+import com.wdkl.ncs.android.component.nursehome.util.VoiceManagerUtil
|
|
|
import com.wdkl.ncs.android.lib.base.BaseApplication
|
|
|
import com.wdkl.ncs.android.lib.utils.AppTool
|
|
|
import com.wdkl.ncs.android.lib.utils.showMessage
|
|
@@ -57,6 +60,10 @@ class SkyCallFragment: BaseCallFragment(), CallSessionCallback {
|
|
|
private var outGoing: Boolean = false
|
|
|
private var acceptCall = false
|
|
|
|
|
|
+ private var speakerMute = false
|
|
|
+ private var micMute: Boolean = false // 是否关闭麦克风
|
|
|
+ private var volume = 60
|
|
|
+
|
|
|
private var janusClient: JanusClient? = null
|
|
|
private var room: Room?=null
|
|
|
private var videoRoomCallback: VideoRoomCallback? = null
|
|
@@ -70,6 +77,16 @@ class SkyCallFragment: BaseCallFragment(), CallSessionCallback {
|
|
|
|
|
|
override fun init() {
|
|
|
initCountDownTimer()
|
|
|
+
|
|
|
+ volume = SettingConfig.getHostHandsFreePlayVolume(activity)
|
|
|
+ if (volume < 0 || volume > 100) {
|
|
|
+ volume = 60
|
|
|
+ }
|
|
|
+ call_volume_bar.progress = volume/10
|
|
|
+ tv_volume.text = "" + volume/10
|
|
|
+
|
|
|
+ VoiceManagerUtil.setCallVoice(activity, volume)
|
|
|
+
|
|
|
//初始化 engine
|
|
|
WebRTCEngine.getInstance().init(true, BaseApplication.appContext)
|
|
|
//初始化 janusClient
|
|
@@ -183,6 +200,45 @@ class SkyCallFragment: BaseCallFragment(), CallSessionCallback {
|
|
|
Constants.CALL_STATE = Constants.CALL_STANDBY
|
|
|
DeviceChannel.calling = false
|
|
|
}
|
|
|
+
|
|
|
+ sky_voice_call_speaker.setOnClickListener {
|
|
|
+ speakerMute = !speakerMute
|
|
|
+ Log.d(TAG,"Speaker enable: $speakerMute")
|
|
|
+
|
|
|
+ WebRTCEngine.getInstance().setVolumeMute(speakerMute)
|
|
|
+ sky_voice_call_speaker.isSelected = speakerMute
|
|
|
+ }
|
|
|
+
|
|
|
+ sky_voice_call_mute.setOnClickListener {
|
|
|
+ micMute = !micMute
|
|
|
+ Log.d(TAG,"静音切换: $micMute")
|
|
|
+
|
|
|
+ WebRTCEngine.getInstance().muteAudio(micMute)
|
|
|
+ sky_voice_call_mute.isSelected = micMute
|
|
|
+ }
|
|
|
+
|
|
|
+ call_volume_bar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener{
|
|
|
+ override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
|
|
|
+ tv_volume.text = "" + progress
|
|
|
+ if (seekBar!!.progress <= 1) {
|
|
|
+ tv_volume.text = "1"
|
|
|
+ } else {
|
|
|
+ tv_volume.text = "" + progress
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onStartTrackingTouch(seekBar: SeekBar?) {
|
|
|
+ //
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onStopTrackingTouch(seekBar: SeekBar?) {
|
|
|
+ if (seekBar!!.progress <= 2) {
|
|
|
+ VoiceManagerUtil.setCallVoice(activity, 20)
|
|
|
+ } else {
|
|
|
+ VoiceManagerUtil.setCallVoice(activity, seekBar.progress*10)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
override fun destroy() {
|
|
@@ -232,6 +288,9 @@ class SkyCallFragment: BaseCallFragment(), CallSessionCallback {
|
|
|
sky_voice_call_timer.visibility = View.VISIBLE
|
|
|
sky_voice_call_timer.base = SystemClock.elapsedRealtime()
|
|
|
sky_voice_call_timer.start()
|
|
|
+ sky_voice_call_speaker.visibility = View.VISIBLE
|
|
|
+ sky_voice_call_mute.visibility = View.VISIBLE
|
|
|
+ ll_voice_volume_bar.visibility = View.VISIBLE
|
|
|
}
|
|
|
|
|
|
private fun cancelCall(fromId: Int, toId: Int?, interactionId: Int?) {
|