Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨凯
YDL-Component-Medical
Commits
698a04c6
Commit
698a04c6
authored
Aug 16, 2022
by
万齐军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
音量上报与挂断音效
parent
9a05908a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
0 deletions
+50
-0
AudioHomeActivity.kt
m-audioim/src/main/java/com/ydl/audioim/AudioHomeActivity.kt
+28
-0
ConsultantAudioHomeActivity.kt
m-audioim/src/main/java/com/ydl/consultantim/ConsultantAudioHomeActivity.kt
+22
-0
effect_hand_up.mp3
m-audioim/src/main/res/raw/effect_hand_up.mp3
+0
-0
No files found.
m-audioim/src/main/java/com/ydl/audioim/AudioHomeActivity.kt
View file @
698a04c6
...
...
@@ -10,6 +10,7 @@ import android.hardware.Sensor
import
android.hardware.SensorEvent
import
android.hardware.SensorEventListener
import
android.hardware.SensorManager
import
android.media.AudioManager
import
android.media.MediaPlayer
import
android.net.Uri
import
android.os.*
...
...
@@ -29,6 +30,7 @@ import com.hjq.permissions.XXPermissions
import
com.ydl.audioim.bean.AgoraInvitationBean
import
com.ydl.audioim.bean.AgoraLogInfoBean
import
com.ydl.audioim.contract.IAudioHomeActivityContract
import
com.ydl.audioim.http.AudioNetAPi
import
com.ydl.audioim.http.command.ConnectCommand
import
com.ydl.audioim.http.command.ConnectExceptionCommand
import
com.ydl.audioim.http.command.NoticePushCommand
...
...
@@ -42,6 +44,7 @@ import com.ydl.audioim.utils.DateUtils
import
com.ydl.audioim.utils.onConfideEvent
import
com.ydl.audioim.widget.AxbConfirmDialog
import
com.ydl.audioim.widget.ZDialog
import
com.ydl.devicesidlib.DeviceIDHelper
import
com.ydl.webview.H5Params
import
com.ydl.webview.NewH5Activity
import
com.ydl.webview.RefreshWebEvent
...
...
@@ -64,6 +67,7 @@ import com.ydl.ydlcommon.utils.log.AliYunRichLogsHelper
import
com.ydl.ydlcommon.utils.log.LogHelper
import
com.ydl.ydlcommon.utils.log.XLog
import
com.ydl.ydlcommon.utils.remind.ToastHelper
import
com.ydl.ydlnet.YDLHttpUtils
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.im.api.bean.IMRegisterObserverCustomNotificationCallBack
import
com.yidianling.im.api.service.IImService
...
...
@@ -72,8 +76,10 @@ import de.greenrobot.event.EventBus
import
io.agora.rtc.Constants
import
io.agora.rtc.IRtcEngineEventHandler
import
io.reactivex.Observable
import
io.reactivex.Single
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.disposables.Disposable
import
io.reactivex.functions.Consumer
import
io.reactivex.schedulers.Schedulers
import
kotlinx.android.synthetic.main.audioim_activity_audio_home.*
import
java.util.*
...
...
@@ -90,6 +96,9 @@ import java.util.concurrent.TimeUnit
class
AudioHomeActivity
:
BaseMvpActivity
<
IAudioHomeActivityContract
.
View
,
IAudioHomeActivityContract
.
Presenter
>(),
IAudioHomeActivityContract
.
View
,
SensorEventListener
{
companion
object
{
const
val
EFFECT_HANGUP
=
3001
}
/**
* 专家头像地址
...
...
@@ -526,6 +535,7 @@ class AudioHomeActivity :
return
R
.
layout
.
audioim_activity_audio_home
}
@SuppressLint
(
"CheckResult"
)
override
fun
initDataAndEvent
()
{
//状态栏颜色
setWindowStatusBarColor
()
...
...
@@ -553,6 +563,22 @@ class AudioHomeActivity :
requestPermission
()
findRouteService
(
IImService
::
class
.
java
).
registerObserveCustomNotification
(
notificationCallback
)
Single
.
create
<
Int
>
{
val
audioManager
=
getSystemService
(
Context
.
AUDIO_SERVICE
)
as
AudioManager
val
callMax
=
audioManager
.
getStreamMaxVolume
(
AudioManager
.
STREAM_VOICE_CALL
)
val
call
=
audioManager
.
getStreamVolume
(
AudioManager
.
STREAM_VOICE_CALL
)
val
callPercent
=
(
100F
*
call
/
callMax
).
toInt
()
it
.
onSuccess
(
callPercent
)
}
.
subscribeOn
(
Schedulers
.
io
())
.
subscribe
(
Consumer
{
val
req
=
hashMapOf
(
"deviceId"
to
DeviceIDHelper
.
getInstance
().
deviceId
,
"voice"
to
it
)
YDLHttpUtils
.
obtainApi
(
AudioNetAPi
::
class
.
java
).
report
(
req
).
subscribe
()
})
ActionCountUtils
.
record
(
"call_phone_page"
,
"call_phone_page_visit"
,
listenerUid
?:
"0"
,
"1"
)
}
...
...
@@ -1462,6 +1488,7 @@ class AudioHomeActivity :
//播放结束音频
playFinishMusic
()
// 声网离开房间
voiceManage
?.
getVoiceApi
()
?.
playEffect
(
EFFECT_HANGUP
,
"res://raw/${R.raw.effect_hand_up}"
)
voiceManage
?.
getVoiceApi
()
?.
leaveChannel
()
}
}
...
...
@@ -1649,6 +1676,7 @@ class AudioHomeActivity :
if
(
null
!=
voiceManage
&&
null
!=
voiceManage
?.
getVoiceApi
())
{
if
(!
isLeavelChannel
)
{
// 声网离开房间
voiceManage
?.
getVoiceApi
()
?.
playEffect
(
EFFECT_HANGUP
,
"res://raw/${R.raw.effect_hand_up}"
)
voiceManage
?.
getVoiceApi
()
?.
leaveChannel
()
}
// voiceManage?.getVoiceApi()?.destroy()
...
...
m-audioim/src/main/java/com/ydl/consultantim/ConsultantAudioHomeActivity.kt
View file @
698a04c6
...
...
@@ -10,6 +10,7 @@ import android.hardware.Sensor
import
android.hardware.SensorEvent
import
android.hardware.SensorEventListener
import
android.hardware.SensorManager
import
android.media.AudioManager
import
android.net.Uri
import
android.os.PowerManager
import
android.provider.Settings
...
...
@@ -25,6 +26,7 @@ import com.google.gson.Gson
import
com.tbruyelle.rxpermissions2.RxPermissions
import
com.ydl.audioim.R
import
com.ydl.audioim.YDLavManager
import
com.ydl.audioim.http.AudioNetAPi
import
com.ydl.audioim.http.command.ConnectExceptionCommand
import
com.ydl.audioim.http.command.PayLoad
import
com.ydl.audioim.player.AudioPlayer
...
...
@@ -35,6 +37,7 @@ import com.ydl.consultantim.event.AudioHomeEvent
import
com.ydl.consultantim.presenter.ConsultantAudioHomePresenterImpl
import
com.ydl.consultantim.utils.ConsultantAudioUtils
import
com.ydl.consultantim.utils.VibratorUtil
import
com.ydl.devicesidlib.DeviceIDHelper
import
com.ydl.ydl_av.chat.bean.AudioMessageBean
import
com.ydl.ydl_av.voice.listener.IYDLVoiceEventHandler
import
com.ydl.ydl_av.voice.listener.RtcNetInterface
...
...
@@ -54,13 +57,16 @@ import com.ydl.ydlcommon.utils.log.AliYunRichLogsHelper
import
com.ydl.ydlcommon.utils.log.LogHelper
import
com.ydl.ydlcommon.utils.log.XLog
import
com.ydl.ydlcommon.utils.remind.ToastHelper
import
com.ydl.ydlnet.YDLHttpUtils
import
com.yidianling.user.api.service.IUserService
import
de.greenrobot.event.EventBus
import
io.agora.rtc.Constants
import
io.agora.rtc.IRtcEngineEventHandler
import
io.reactivex.Observable
import
io.reactivex.Single
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.disposables.Disposable
import
io.reactivex.functions.Consumer
import
io.reactivex.schedulers.Schedulers
import
kotlinx.android.synthetic.main.audioim_cativity_consultant_audio_home.*
import
java.util.*
...
...
@@ -492,6 +498,7 @@ class ConsultantAudioHomeActivity :
@SuppressLint
(
"CheckResult"
)
override
fun
initDataAndEvent
()
{
EventBus
.
getDefault
().
register
(
this
)
callEventSave
(
"30"
,
"进入接听界面"
)
...
...
@@ -507,6 +514,21 @@ class ConsultantAudioHomeActivity :
initData
()
//获取声网频道号
getChannelToken
()
Single
.
create
<
Int
>
{
val
audioManager
=
getSystemService
(
Context
.
AUDIO_SERVICE
)
as
AudioManager
val
callMax
=
audioManager
.
getStreamMaxVolume
(
AudioManager
.
STREAM_VOICE_CALL
)
val
call
=
audioManager
.
getStreamVolume
(
AudioManager
.
STREAM_VOICE_CALL
)
val
callPercent
=
(
100F
*
call
/
callMax
).
toInt
()
it
.
onSuccess
(
callPercent
)
}
.
subscribeOn
(
Schedulers
.
io
())
.
subscribe
(
Consumer
{
val
req
=
hashMapOf
(
"deviceId"
to
DeviceIDHelper
.
getInstance
().
deviceId
,
"voice"
to
it
)
YDLHttpUtils
.
obtainApi
(
AudioNetAPi
::
class
.
java
).
report
(
req
).
subscribe
()
})
}
private
fun
setWindowStatusBarColor
()
{
...
...
m-audioim/src/main/res/raw/effect_hand_up.mp3
0 → 100644
View file @
698a04c6
File added
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment