Commit b7ff1de9 authored by Maxime Callet's avatar Maxime Callet
Browse files

call: split local and peer video surface management

Change-Id: If8341dd461821d83a11d9f98764be3e4474ede4c
parent 519fa74c
......@@ -96,17 +96,20 @@ class CallActivity : AppCompatActivity() {
private fun handleNewIntent(intent: Intent) {
val action = intent.action
val hasVideo = intent.getBooleanExtra(CallFragment.KEY_HAS_VIDEO, false)
val wantVideo = intent.getBooleanExtra(CallFragment.KEY_HAS_VIDEO, false)
if (Intent.ACTION_CALL == action) {
val contactId = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER)
val callFragment = CallFragment.newInstance(action, fromIntent(intent), contactId, hasVideo)
val callFragment = CallFragment.newInstance(action, fromIntent(intent), contactId, wantVideo)
supportFragmentManager.beginTransaction()
.replace(R.id.main_call_layout, callFragment, CALL_FRAGMENT_TAG).commit()
} else if (Intent.ACTION_VIEW == action || ACTION_CALL_ACCEPT == action) {
val confId = intent.getStringExtra(NotificationService.KEY_CALL_ID)
val callFragment = CallFragment.newInstance(action, confId, hasVideo)
supportFragmentManager.beginTransaction()
.replace(R.id.main_call_layout, callFragment, CALL_FRAGMENT_TAG).commit()
val currentId = callFragment?.arguments?.get(NotificationService.KEY_CALL_ID)
if (currentId != confId) {
val callFragment = CallFragment.newInstance(action, confId, wantVideo)
supportFragmentManager.beginTransaction()
.replace(R.id.main_call_layout, callFragment, CALL_FRAGMENT_TAG).commit()
}
}
}
......@@ -125,7 +128,6 @@ class CallActivity : AppCompatActivity() {
}
public override fun onUserLeaveHint() {
val callFragment = callFragment
callFragment?.onUserLeave()
}
......@@ -183,16 +185,11 @@ class CallActivity : AppCompatActivity() {
// Get the call Fragment
private val callFragment: CallFragment?
get() {
var callFragment: CallFragment? = null
// Get the call Fragment
val fragment = supportFragmentManager.findFragmentByTag(CALL_FRAGMENT_TAG)
if (fragment is CallFragment) {
callFragment = fragment
}
return callFragment
return supportFragmentManager.findFragmentByTag(CALL_FRAGMENT_TAG) as CallFragment?
}
companion object {
private val TAG = CallActivity::class.simpleName!!
const val ACTION_CALL_ACCEPT = BuildConfig.APPLICATION_ID + ".action.CALL_ACCEPT"
private const val CALL_FRAGMENT_TAG = "CALL_FRAGMENT_TAG"
......
......@@ -36,6 +36,7 @@ import net.jami.services.ConversationFacade
import net.jami.model.Account
import net.jami.model.Conference
import net.jami.services.CallService
import net.jami.services.NotificationService
import net.jami.smartlist.SmartListViewModel
import javax.inject.Inject
import javax.inject.Singleton
......@@ -74,7 +75,7 @@ class ConversationSelectionActivity : AppCompatActivity() {
public override fun onStart() {
super.onStart()
val conference: Conference? = intent?.getStringExtra(CallFragment.KEY_CONF_ID)?.let { confId -> mCallService.getConference(confId) }
val conference: Conference? = intent?.getStringExtra(NotificationService.KEY_CALL_ID)?.let { confId -> mCallService.getConference(confId) }
mDisposable.add(mConversationFacade
.currentAccountSubject
.switchMap { a: Account -> a.getConversationsViewModels(false) }
......
......@@ -152,7 +152,7 @@ class CallFragment : BaseSupportFragment<CallPresenter, CallView>(), CallView,
}
else if (action == Intent.ACTION_VIEW || action == CallActivity.ACTION_CALL_ACCEPT) {
Log.w(TAG, "DEBUG fn initPresenter [CallFragment.kt] -> requesting fn initIncomingCall( CONF_ID, GET_CALL)")
presenter.initIncomingCall(args.getString(KEY_CONF_ID)!!, action == Intent.ACTION_VIEW)
presenter.initIncomingCall(args.getString(NotificationService.KEY_CALL_ID)!!, action == Intent.ACTION_VIEW)
}
}
}
......@@ -200,37 +200,9 @@ class CallFragment : BaseSupportFragment<CallPresenter, CallView>(), CallView,
}
}
override fun onStart() {
super.onStart()
Log.w(TAG, "DEBUG fn onStart [CallFragment.kt] -> on start, value hasVideo = ${presenter.wantVideo}, restartvideo : $restartVideo | restartPreview : $restartPreview")
if (restartVideo && restartPreview) {
displayVideoSurface(true, !presenter.isPipMode && presenter.wantVideo)
restartVideo = false
restartPreview = false
} else if (restartVideo) {
displayVideoSurface(displayVideoSurface = true, displayPreviewContainer = false)
restartVideo = false
}
}
override fun onStop() {
super.onStop()
previewSnapAnimation.cancel()
binding?.let { binding ->
if (binding.videoSurface.visibility == View.VISIBLE) {
restartVideo = true
}
if (!isChoosePluginMode) {
if (binding.previewContainer.visibility == View.VISIBLE) {
restartPreview = true
}
} else {
if (binding.pluginPreviewContainer.visibility == View.VISIBLE) {
restartPreview = true
presenter.stopPlugin()
}
}
}
}
override fun onCreateView(
......@@ -693,26 +665,22 @@ class CallFragment : BaseSupportFragment<CallPresenter, CallView>(), CallView,
}
override fun onCreateOptionsMenu(m: Menu, inf: MenuInflater) {
super.onCreateOptionsMenu(m, inf)
inf.inflate(R.menu.ac_call, m)
dialPadBtn = m.findItem(R.id.menuitem_dialpad)
pluginsMenuBtn = m.findItem(R.id.menuitem_video_plugins)
}
override fun onPrepareOptionsMenu(menu: Menu) {
super.onPrepareOptionsMenu(menu)
Log.w(CallPresenter.TAG, "DEBUG onPrepareOptionsMenu")
presenter.prepareOptionMenu()
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
super.onOptionsItemSelected(item)
val itemId = item.itemId
if (itemId == android.R.id.home) {
presenter.chatClick()
} else if (itemId == R.id.menuitem_dialpad) {
presenter.dialpadClick()
} else if (itemId == R.id.menuitem_video_plugins) {
displayVideoPluginsCarousel()
when (item.itemId) {
android.R.id.home -> presenter.chatClick()
R.id.menuitem_dialpad -> presenter.dialpadClick()
R.id.menuitem_video_plugins -> displayVideoPluginsCarousel()
else -> return super.onOptionsItemSelected(item)
}
return true
}
......@@ -732,34 +700,23 @@ class CallFragment : BaseSupportFragment<CallPresenter, CallView>(), CallView,
}
override fun displayContactBubble(display: Boolean) {
if (binding != null) binding!!.contactBubbleLayout.handler.post {
if (binding != null) binding!!.contactBubbleLayout.visibility =
if (display) View.VISIBLE else View.GONE
Log.w(TAG, "DEBUG fn displayContactBubble -> $display")
binding?.apply {
contactBubbleLayout.visibility = if (display) View.VISIBLE else View.GONE
}
}
override fun displayVideoSurface(
displayVideoSurface: Boolean,
displayPreviewContainer: Boolean
) {
Log.w(TAG, "DEBUG fn displayVideoSurface [CallFragment.kt] -> changement des affichages videos displayVideoSurface: $displayVideoSurface; displayPreviewContainer: $displayPreviewContainer")
binding!!.videoSurface.visibility = if (displayVideoSurface) View.VISIBLE else View.GONE
override fun displayPeerVideo(display: Boolean) {
Log.w(TAG, "DEBUG fn displayPeerVideo -> $display")
binding!!.videoSurface.visibility = if (display) View.VISIBLE else View.GONE
displayContactBubble(!display)
}
if (isChoosePluginMode) {
Log.w(TAG, "DEBUG fn displayVideoSurface |1| inside => if (isChoosePluginMode) {displayPreviewContainer: $displayPreviewContainer}")
binding!!.pluginPreviewSurface.visibility =
if (displayPreviewContainer) View.VISIBLE else View.GONE
binding!!.pluginPreviewContainer.visibility =
if (displayPreviewContainer) View.VISIBLE else View.GONE
binding!!.previewContainer.visibility = View.GONE
} else {
Log.w(TAG, "DEBUG fn displayVideoSurface |2| inside => else { displayPreviewContainer : $displayPreviewContainer}")
binding!!.pluginPreviewSurface.visibility = View.GONE
binding!!.pluginPreviewContainer.visibility = View.GONE
binding!!.previewContainer.visibility =
if (displayPreviewContainer) View.VISIBLE else View.GONE
}
updateMenu()
override fun displayLocalVideo(display: Boolean) {
Log.w(TAG, "DEBUG fn displayLocalVideo -> $display")
/*binding!!.pluginPreviewSurface.visibility = View.GONE
binding!!.pluginPreviewContainer.visibility = View.GONE*/
binding!!.previewContainer.visibility = if (display) View.VISIBLE else View.GONE
}
// todo Change function name, this name is misleading, this function concerns PIP preview
......@@ -853,6 +810,10 @@ class CallFragment : BaseSupportFragment<CallPresenter, CallView>(), CallView,
activity.intent = Intent(Intent.ACTION_VIEW,
ConversationPath.toUri(call.account!!, conversationUri), context, CallActivity::class.java)
.apply { putExtra(NotificationService.KEY_CALL_ID, call.confId ?: call.daemonIdString) }
arguments = Bundle().apply {
putString(KEY_ACTION, Intent.ACTION_VIEW)
putString(NotificationService.KEY_CALL_ID, call.confId ?: call.daemonIdString)
}
}
}
if (hasProfileName) {
......@@ -968,24 +929,19 @@ class CallFragment : BaseSupportFragment<CallPresenter, CallView>(), CallView,
isSpeakerOn: Boolean, hasMultipleCamera: Boolean, canDial: Boolean,
showPluginBtn: Boolean, onGoingCall: Boolean, hasActiveVideo: Boolean
) {
//
if (!hasActiveVideo) {
binding!!.callCameraSwitchBtn.isChecked = true
binding!!.callCameraSwitchBtn.setImageResource(R.drawable.baseline_videocam_off_24)
}
binding!!.callCameraFlipBtn.visibility = if (hasMultipleCamera && !binding!!.callCameraSwitchBtn.isChecked) View.VISIBLE else View.GONE
if (dialPadBtn != null) {
dialPadBtn!!.isVisible = canDial
}
if (pluginsMenuBtn != null) {
pluginsMenuBtn!!.isVisible = showPluginBtn
Log.w(CallPresenter.TAG, "DEBUG initMenu hasActiveVideo: $hasActiveVideo; hasMultipleCamera: $hasMultipleCamera")
binding?.apply {
callSpeakerBtn.visibility = if (hasActiveVideo) View.GONE else View.VISIBLE
callCameraSwitchBtn.isChecked = !hasActiveVideo
callCameraSwitchBtn.setImageResource(if (hasActiveVideo) R.drawable.baseline_videocam_24 else R.drawable.baseline_videocam_off_24)
callCameraFlipBtn.visibility = if (hasMultipleCamera && hasActiveVideo) View.VISIBLE else View.GONE
}
dialPadBtn?.isVisible = canDial
pluginsMenuBtn?.isVisible = showPluginBtn
updateMenu()
}
override fun initNormalStateDisplay(audioOnly: Boolean, isMuted: Boolean) {
Log.w(TAG, "initNormalStateDisplay")
override fun initNormalStateDisplay(isMuted: Boolean) {
binding?.apply {
shapeRipple.stopRipple()
callAcceptBtn.visibility = View.GONE
......@@ -993,7 +949,7 @@ class CallFragment : BaseSupportFragment<CallPresenter, CallView>(), CallView,
callRefuseBtn.visibility = View.GONE
callControlGroup.visibility = View.VISIBLE
callHangupBtn.visibility = View.VISIBLE
contactBubbleLayout.visibility = if (audioOnly) View.VISIBLE else View.GONE
contactBubbleLayout.visibility = View.VISIBLE
callMicBtn.isChecked = isMuted
}
requireActivity().invalidateOptionsMenu()
......@@ -1203,8 +1159,10 @@ class CallFragment : BaseSupportFragment<CallPresenter, CallView>(), CallView,
//todo if videomode, should mute/unmute audio output, if audio only, should switch between speaker options
fun speakerClicked() {
presenter.speakerClick(binding!!.callSpeakerBtn.isChecked)
//binding!!.callSpeakerBtn.setImageResource(if (binding!!.callSpeakerBtn.isChecked) R.drawable.baseline_sound_on_24 else R.drawable.baseline_sound_off_24)
binding?.let {
presenter.speakerClick(it.callSpeakerBtn.isChecked)
//it.callSpeakerBtn.setImageResource(if (it.callSpeakerBtn.isChecked) R.drawable.baseline_sound_on_24 else R.drawable.baseline_sound_off_24)
}
}
private fun startScreenShare(mediaProjection: MediaProjection?) {
......@@ -1273,7 +1231,7 @@ class CallFragment : BaseSupportFragment<CallPresenter, CallView>(), CallView,
override fun startAddParticipant(conferenceId: String) {
startActivityForResult(Intent(Intent.ACTION_PICK)
.setClass(requireActivity(), ConversationSelectionActivity::class.java)
.putExtra(KEY_CONF_ID, conferenceId),
.putExtra(NotificationService.KEY_CALL_ID, conferenceId),
REQUEST_CODE_ADD_PARTICIPANT)
}
......@@ -1401,7 +1359,7 @@ class CallFragment : BaseSupportFragment<CallPresenter, CallView>(), CallView,
}
//change preview image
displayVideoSurface(true, presenter.wantVideo)
//displayPeerVideo(true, presenter.wantVideo)
}
/**
......@@ -1455,7 +1413,6 @@ class CallFragment : BaseSupportFragment<CallPresenter, CallView>(), CallView,
val TAG = CallFragment::class.simpleName!!
const val ACTION_PLACE_CALL = "PLACE_CALL"
const val KEY_ACTION = "action"
const val KEY_CONF_ID = "confId"
const val KEY_HAS_VIDEO = "HAS_VIDEO"
private const val REQUEST_CODE_ADD_PARTICIPANT = 6
private const val REQUEST_PERMISSION_INCOMING = 1003
......@@ -1463,6 +1420,7 @@ class CallFragment : BaseSupportFragment<CallPresenter, CallView>(), CallView,
private const val REQUEST_CODE_SCREEN_SHARE = 7
fun newInstance(action: String, path: ConversationPath?, contactId: String?, hasVideo: Boolean): CallFragment {
Log.w(TAG, "DEBUG newInstance $action $path $contactId $hasVideo")
return CallFragment().apply {
arguments = Bundle().apply {
putString(KEY_ACTION, action)
......@@ -1474,10 +1432,11 @@ class CallFragment : BaseSupportFragment<CallPresenter, CallView>(), CallView,
}
fun newInstance(action: String, confId: String?, hasVideo: Boolean): CallFragment {
Log.w(TAG, "DEBUG newInstance $action $confId $hasVideo")
return CallFragment().apply {
arguments = Bundle().apply {
putString(KEY_ACTION, action)
putString(KEY_CONF_ID, confId)
putString(NotificationService.KEY_CALL_ID, confId)
putBoolean(KEY_HAS_VIDEO, hasVideo)
}
}
......
......@@ -320,30 +320,22 @@ class HardwareServiceImpl(
}
override fun decodingStarted(id: String, shmPath: String, width: Int, height: Int, isMixer: Boolean) {
Log.i(TAG, "decodingStarted() " + id + " " + width + "x" + height)
Log.i(TAG, "DEBUG decodingStarted() " + id + " " + width + "x" + height)
val shm = Shm(id, width, height)
videoInputs[id] = shm
videoEvents.onNext(VideoEvent(id, start = true))
videoSurfaces[id]?.get()?.let { holder ->
shm.window = startVideo(id, holder.surface, width, height)
if (shm.window == 0L) {
Log.i(TAG, "DJamiService.decodingStarted() no window !")
val event = VideoEvent()
event.start = true
event.callId = shm.id
videoEvents.onNext(event)
return
Log.w(TAG, "DJamiService.decodingStarted() no window !")
} else {
videoEvents.onNext(VideoEvent(shm.id, started = true, w = shm.w, h = shm.h))
}
val event = VideoEvent()
event.callId = shm.id
event.started = true
event.w = shm.w
event.h = shm.h
videoEvents.onNext(event)
}
}
override fun decodingStopped(id: String, shmPath: String, isMixer: Boolean) {
Log.i(TAG, "decodingStopped() $id")
Log.i(TAG, "DEBUG decodingStopped() $id")
val shm = videoInputs.remove(id) ?: return
if (shm.window != 0L) {
try {
......@@ -352,9 +344,14 @@ class HardwareServiceImpl(
Log.e(TAG, "decodingStopped error$e")
}
shm.window = 0
videoEvents.onNext(VideoEvent(id, started = false))
}
}
override fun hasInput(id: String): Boolean {
return videoInputs[id] !== null
}
override fun getCameraInfo(camId: String, formats: IntVect, sizes: UintVect, rates: UintVect) {
// Use a larger resolution for Android 6.0+, 64 bits devices
val useLargerSize =
......@@ -444,9 +441,7 @@ class HardwareServiceImpl(
if (surface == null) {
Log.w(TAG, "Can't start capture: no surface registered.")
cameraService.setPreviewParams(videoParams)
val event = VideoEvent()
event.start = true
videoEvents.onNext(event)
videoEvents.onNext(VideoEvent(start = true))
return
}
val conf = mCameraPreviewCall.get()
......@@ -491,12 +486,12 @@ class HardwareServiceImpl(
)
}
cameraService.setPreviewParams(videoParams)
val event = VideoEvent()
event.started = true
event.w = videoParams.width
event.h = videoParams.height
event.rot = videoParams.rotation
videoEvents.onNext(event)
videoEvents.onNext(VideoEvent(
started = true,
w = videoParams.width,
h = videoParams.height,
rot = videoParams.rotation
))
}
override fun stopCapture() {
......@@ -521,11 +516,7 @@ class HardwareServiceImpl(
if (cameraService.isOpen) {
//final CameraService.VideoParams params = previewParams;
cameraService.closeCamera()
val event = VideoEvent()
event.started = false
//event.w = params.width;
//event.h = params.height;
videoEvents.onNext(event)
videoEvents.onNext(VideoEvent(started = false))
}
mIsCapturing = false
}
......@@ -543,17 +534,10 @@ class HardwareServiceImpl(
}
if (shm == null || shm.window == 0L) {
Log.i(TAG, "DJamiService.addVideoSurface() no window !")
val event = VideoEvent()
event.start = true
videoEvents.onNext(event)
return
//videoEvents.onNext(VideoEvent(id, start = true))
} else {
videoEvents.onNext(VideoEvent(shm.id, started = true, w = shm.w, h = shm.h))
}
val event = VideoEvent()
event.callId = shm.id
event.started = true
event.w = shm.w
event.h = shm.h
videoEvents.onNext(event)
}
override fun updateVideoSurfaceId(currentId: String, newId: String) {
......@@ -607,10 +591,7 @@ class HardwareServiceImpl(
}
shm.window = 0
}
val event = VideoEvent()
event.callId = shm.id
event.started = false
videoEvents.onNext(event)
//videoEvents.onNext(VideoEvent(shm.id, started = false))
}
override fun removePreviewVideoSurface() {
......@@ -642,12 +623,12 @@ class HardwareServiceImpl(
cameraService.setOrientation(rotation)
if (mCapturingId != null) {
val videoParams = cameraService.getParams(mCapturingId)
val event = VideoEvent()
event.started = true
event.w = videoParams.width
event.h = videoParams.height
event.rot = videoParams.rotation
videoEvents.onNext(event)
videoEvents.onNext(VideoEvent(
started = true,
w = videoParams.width,
h = videoParams.height,
rot = videoParams.rotation
))
}
}
......
......@@ -145,31 +145,27 @@ class NotificationServiceImpl(
R.drawable.baseline_call_end_24, mContext.getText(R.string.action_call_decline),
PendingIntent.getService(mContext, random.nextInt(), Intent(DRingService.ACTION_CALL_REFUSE)
.setClass(mContext, DRingService::class.java)
.putExtra(NotificationService.KEY_CALL_ID, call.daemonIdString), PendingIntent.FLAG_ONE_SHOT
)
)
.putExtra(NotificationService.KEY_CALL_ID, call.daemonIdString), PendingIntent.FLAG_ONE_SHOT))
Log.w(TAG, "DEBUG fn buildCallNotification [NotificationServiceImpl.kt] -> conference.hasvideo = ${conference.hasVideo()} ")
if (conference.hasVideo()){
messageNotificationBuilder
.addAction(R.id.btnAcceptAudio, if (ongoingCallId == null) mContext.getText(R.string.action_call_accept_audio) else mContext.getText(R.string.action_call_end_accept),
PendingIntent.getService(mContext, random.nextInt(), Intent(if (ongoingCallId == null) DRingService.ACTION_CALL_ACCEPT else DRingService.ACTION_CALL_END_ACCEPT)
.addAction(R.drawable.baseline_call_24, if (ongoingCallId == null) mContext.getText(R.string.action_call_accept_audio) else mContext.getText(R.string.action_call_hold_accept),
PendingIntent.getService(mContext, random.nextInt(), Intent(if (ongoingCallId == null) DRingService.ACTION_CALL_ACCEPT else DRingService.ACTION_CALL_HOLD_ACCEPT)
.setClass(mContext, DRingService::class.java)
.putExtra(NotificationService.KEY_END_ID, ongoingCallId)
.putExtra(NotificationService.KEY_HOLD_ID, ongoingCallId)
.putExtra(NotificationService.KEY_CALL_ID, call.daemonIdString)
.putExtra(CallFragment.KEY_HAS_VIDEO, false), PendingIntent.FLAG_ONE_SHOT)
)
.addAction(R.id.btnAcceptVideo, if (ongoingCallId == null) mContext.getText(R.string.action_call_accept_video) else mContext.getText(R.string.action_call_end_accept),
PendingIntent.getService(mContext, random.nextInt(), Intent(if (ongoingCallId == null) DRingService.ACTION_CALL_ACCEPT else DRingService.ACTION_CALL_END_ACCEPT)
.putExtra(CallFragment.KEY_HAS_VIDEO, false), PendingIntent.FLAG_ONE_SHOT))
.addAction(R.drawable.baseline_videocam_24, if (ongoingCallId == null) mContext.getText(R.string.action_call_accept_video) else mContext.getText(R.string.action_call_hold_accept_video),
PendingIntent.getService(mContext, random.nextInt(), Intent(if (ongoingCallId == null) DRingService.ACTION_CALL_ACCEPT else DRingService.ACTION_CALL_HOLD_ACCEPT)
.setClass(mContext, DRingService::class.java)
.putExtra(NotificationService.KEY_END_ID, ongoingCallId)
.putExtra(NotificationService.KEY_HOLD_ID, ongoingCallId)
.putExtra(NotificationService.KEY_CALL_ID, call.daemonIdString)
.putExtra(CallFragment.KEY_HAS_VIDEO, true), PendingIntent.FLAG_ONE_SHOT)
)
.putExtra(CallFragment.KEY_HAS_VIDEO, true), PendingIntent.FLAG_ONE_SHOT))
} else {
messageNotificationBuilder.addAction(
R.id.btnAcceptAudio, if (ongoingCallId == null) mContext.getText(R.string.action_call_accept_audio) else mContext.getText(R.string.action_call_end_accept),
R.drawable.baseline_call_24, if (ongoingCallId == null) mContext.getText(R.string.action_call_accept_audio) else mContext.getText(R.string.action_call_end_accept),
PendingIntent.getService(mContext, random.nextInt(), Intent(if (ongoingCallId == null) DRingService.ACTION_CALL_ACCEPT else DRingService.ACTION_CALL_END_ACCEPT)
.setClass(mContext, DRingService::class.java)
.putExtra(NotificationService.KEY_END_ID, ongoingCallId)
......
......@@ -76,6 +76,7 @@ import net.jami.model.Contact
import net.jami.model.Uri
import net.jami.services.DeviceRuntimeService
import net.jami.services.HardwareService.AudioState
import net.jami.services.NotificationService
import java.util.*
import javax.inject.Inject
import kotlin.math.max
......@@ -119,7 +120,7 @@ class TVCallFragment : BaseSupportFragment<CallPresenter, CallView>(), CallView
if (action == CallFragment.ACTION_PLACE_CALL || action == Intent.ACTION_CALL)
prepareCall(false)
else if (action == Intent.ACTION_VIEW || action == CallActivity.ACTION_CALL_ACCEPT)
presenter.initIncomingCall(args.getString(CallFragment.KEY_CONF_ID)!!, action == Intent.ACTION_VIEW)
presenter.initIncomingCall(args.getString(NotificationService.KEY_CALL_ID)!!, action == Intent.ACTION_VIEW)
}
}
......@@ -262,10 +263,17 @@ class TVCallFragment : BaseSupportFragment<CallPresenter, CallView>(), CallView
override fun displayContactBubble(display: Boolean) {
binding!!.contactBubbleLayout.visibility = if (display) View.VISIBLE else View.GONE
}
override fun displayPeerVideo(display: Boolean) {
Log.w(CallFragment.TAG, "DEBUG fn displayPeerVideo -> $display")
binding!!.videoSurface.visibility = if (display) View.VISIBLE else View.GONE
displayContactBubble(!display)
}
override fun displayVideoSurface(displayVideoSurface: Boolean, displayPreviewContainer: Boolean) {
binding!!.videoSurface.visibility = if (displayVideoSurface) View.VISIBLE else View.GONE
binding!!.previewContainer.visibility = if (displayPreviewContainer) View.VISIBLE else View.GONE
override fun displayLocalVideo(display: Boolean) {
Log.w(CallFragment.TAG, "DEBUG fn displayLocalVideo -> $display")
/*binding!!.pluginPreviewSurface.visibility = View.GONE
binding!!.pluginPreviewContainer.visibility = View.GONE*/
binding!!.previewContainer.visibility = if (display) View.VISIBLE else View.GONE
}
override fun displayPreviewSurface(display: Boolean) {
......@@ -320,20 +328,17 @@ class TVCallFragment : BaseSupportFragment<CallPresenter, CallView>(), CallView
}
}
override fun initMenu(
isSpeakerOn: Boolean, displayFlip: Boolean, canDial: Boolean,
showPluginBtn: Boolean, onGoingCall: Boolean, hasActiveVideo: Boolean
) {
override fun initMenu(isSpeakerOn: Boolean, displayFlip: Boolean, canDial: Boolean, showPluginBtn: Boolean, onGoingCall: Boolean, hasActiveVideo: Boolean) {
}
override fun initNormalStateDisplay(audioOnly: Boolean, muted: Boolean) {
override fun initNormalStateDisplay(muted: Boolean) {
mSession!!.isActive = true
binding?.apply {
shapeRipple.stopRipple()
callAcceptBtn.visibility = View.GONE
callRefuseBtn.visibility = View.GONE
callHangupBtn.visibility = View.VISIBLE
contactBubbleLayout.visibility = if (audioOnly) View.VISIBLE else View.INVISIBLE
contactBubbleLayout.visibility = View.VISIBLE
}
requireActivity().invalidateOptionsMenu()
handleVisibilityTimer()
......@@ -492,31 +497,71 @@ class TVCallFragment : BaseSupportFragment<CallPresenter, CallView>(), CallView
}
@SuppressLint("RestrictedApi")
override fun updateConfInfo(info: List<ParticipantInfo>) {
val binding = binding!!
override fun updateConfInfo(participantInfo: List<ParticipantInfo>) {