|
@@ -42,6 +42,8 @@ class SkyCallFragment: BaseCallFragment(), CallSession.CallSessionCallback {
|
|
|
|
|
|
private var callEnded: Boolean = false
|
|
|
|
|
|
+ private var outGoing: Boolean = false
|
|
|
+
|
|
|
override fun getLayId(): Int {
|
|
|
return R.layout.sky_voice_call_layout
|
|
|
}
|
|
@@ -67,6 +69,7 @@ class SkyCallFragment: BaseCallFragment(), CallSession.CallSessionCallback {
|
|
|
when (callState) {
|
|
|
0 -> {
|
|
|
//发起通话
|
|
|
+ outGoing = true
|
|
|
if (!startCall(targetId!!, onlyAudio)) {
|
|
|
//通话失败,重置并返回主界面
|
|
|
Constants.CALL_STATE = Constants.CALL_STANDBY
|
|
@@ -81,6 +84,7 @@ class SkyCallFragment: BaseCallFragment(), CallSession.CallSessionCallback {
|
|
|
|
|
|
1 -> {
|
|
|
//接受通话
|
|
|
+ outGoing = false
|
|
|
Constants.CALL_STATE = Constants.CALL_CALLING
|
|
|
DeviceChannel.calling = true
|
|
|
val session = gEngineKit?.getCurrentSession()
|
|
@@ -150,7 +154,7 @@ class SkyCallFragment: BaseCallFragment(), CallSession.CallSessionCallback {
|
|
|
sky_voice_call_timer.visibility = View.GONE
|
|
|
}
|
|
|
|
|
|
- //语音接通
|
|
|
+ //语音来电接通
|
|
|
private fun joinAudioCall() {
|
|
|
val session = gEngineKit?.getCurrentSession()
|
|
|
if (session != null) {
|
|
@@ -175,7 +179,7 @@ class SkyCallFragment: BaseCallFragment(), CallSession.CallSessionCallback {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //视频接通
|
|
|
+ //视频来电接通
|
|
|
private fun joinVideoCall() {
|
|
|
val session = gEngineKit?.getCurrentSession()
|
|
|
if (session != null) {
|
|
@@ -322,7 +326,27 @@ class SkyCallFragment: BaseCallFragment(), CallSession.CallSessionCallback {
|
|
|
Log.e("dds", "didCreateLocalVideoTrack surfaceView: " + surfaceView)
|
|
|
if (surfaceView != null) {
|
|
|
localSurfaceView = surfaceView as SurfaceViewRenderer
|
|
|
+ } else {
|
|
|
+ callEnd()
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ localSurfaceView!!.setZOrderMediaOverlay(true)
|
|
|
+ }
|
|
|
+
|
|
|
+ if (localSurfaceView!!.parent != null) {
|
|
|
+ (localSurfaceView!!.parent as ViewGroup).removeView(localSurfaceView)
|
|
|
+ }
|
|
|
+
|
|
|
+ if (outGoing && remoteSurfaceView == null) {
|
|
|
+ if (fullscreen_video_frame != null && fullscreen_video_frame.getChildCount() != 0) {
|
|
|
+ fullscreen_video_frame.removeAllViews()
|
|
|
}
|
|
|
+ fullscreen_video_frame.addView(localSurfaceView)
|
|
|
+ } else {
|
|
|
+ if (pip_video_frame != null && pip_video_frame.getChildCount() != 0) {
|
|
|
+ pip_video_frame.removeAllViews()
|
|
|
+ }
|
|
|
+ pip_video_frame.addView(localSurfaceView)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -337,10 +361,12 @@ class SkyCallFragment: BaseCallFragment(), CallSession.CallSessionCallback {
|
|
|
//本地画面
|
|
|
if (localSurfaceView != null) {
|
|
|
localSurfaceView!!.setZOrderMediaOverlay(true)
|
|
|
- if (localSurfaceView!!.parent != null) {
|
|
|
- (localSurfaceView!!.parent as ViewGroup).removeView(localSurfaceView)
|
|
|
+ if (outGoing) {
|
|
|
+ if (localSurfaceView!!.parent != null) {
|
|
|
+ (localSurfaceView!!.parent as ViewGroup).removeView(localSurfaceView)
|
|
|
+ }
|
|
|
+ pip_video_frame!!.addView(localSurfaceView)
|
|
|
}
|
|
|
- pip_video_frame!!.addView(localSurfaceView)
|
|
|
}
|
|
|
|
|
|
//远端画面
|