|
|
|
|
@ -103,8 +103,6 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
|
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
|
|
requireActivity().setTheme(R.style.AppTheme)
|
|
|
|
|
super.onCreate(savedInstanceState)
|
|
|
|
|
|
|
|
|
|
requestPermissions()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun onStart() {
|
|
|
|
|
@ -155,8 +153,18 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
|
|
|
|
|
|
|
|
|
|
parentView = inflater.inflate(R.layout.activity_video_call, container, false)
|
|
|
|
|
|
|
|
|
|
// Objects.requireNonNull(requireActivity().actionBar)!!.hide()
|
|
|
|
|
// Objects.requireNonNull(requireActivity().actionBar)!!.hide()
|
|
|
|
|
arguments?.run {
|
|
|
|
|
apiKey = getString("apiKey")
|
|
|
|
|
sessionId = getString("sessionId")
|
|
|
|
|
token = getString("token")
|
|
|
|
|
appLang = getString("appLang")
|
|
|
|
|
baseUrl = getString("baseUrl")
|
|
|
|
|
sessionStatusModel = getParcelable("sessionStatusModel")
|
|
|
|
|
}
|
|
|
|
|
initUI(parentView)
|
|
|
|
|
requestPermissions()
|
|
|
|
|
|
|
|
|
|
handleDragDialog()
|
|
|
|
|
|
|
|
|
|
return parentView
|
|
|
|
|
@ -196,15 +204,6 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
|
|
|
|
|
mSubscriberViewIcon = view.findViewById(R.id.remote_video_view_icon)
|
|
|
|
|
mSubscriberViewContainer = view.findViewById(R.id.remote_video_view_container)
|
|
|
|
|
|
|
|
|
|
arguments?.run {
|
|
|
|
|
apiKey = getString("apiKey")
|
|
|
|
|
sessionId = getString("sessionId")
|
|
|
|
|
token = getString("token")
|
|
|
|
|
appLang = getString("appLang")
|
|
|
|
|
baseUrl = getString("baseUrl")
|
|
|
|
|
sessionStatusModel = getParcelable("sessionStatusModel")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
patientName = view.findViewById<TextView>(R.id.patient_name)
|
|
|
|
|
patientName.text = sessionStatusModel!!.patientName
|
|
|
|
|
|
|
|
|
|
@ -220,8 +219,9 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
|
|
|
|
|
} else {
|
|
|
|
|
minutes = (elapsedTime - cmTimer.base) / 1000 / 60
|
|
|
|
|
seconds = (elapsedTime - cmTimer.base) / 1000 % 60
|
|
|
|
|
elapsedTime = elapsedTime + 1000
|
|
|
|
|
elapsedTime += 1000
|
|
|
|
|
}
|
|
|
|
|
arg0?.text = "$minutes:$seconds"
|
|
|
|
|
Log.d(VideoCallFragment.TAG, "onChronometerTick: $minutes : $seconds")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -257,12 +257,19 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
|
|
|
|
|
// progressBar.setVisibility(View.GONE);
|
|
|
|
|
hiddenButtons()
|
|
|
|
|
checkClientConnected()
|
|
|
|
|
mSubscriberViewContainer!!.setOnTouchListener { v: View?, event: MotionEvent? ->
|
|
|
|
|
|
|
|
|
|
mSubscriberViewContainer.setOnClickListener {
|
|
|
|
|
controlPanel!!.visibility = View.VISIBLE
|
|
|
|
|
mVolHandler!!.removeCallbacks(mVolRunnable!!)
|
|
|
|
|
mVolHandler!!.postDelayed(mVolRunnable!!, (5 * 1000).toLong())
|
|
|
|
|
true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// mSubscriberViewContainer!!.setOnTouchListener { v: View?, event: MotionEvent? ->
|
|
|
|
|
// controlPanel!!.visibility = View.VISIBLE
|
|
|
|
|
// mVolHandler!!.removeCallbacks(mVolRunnable!!)
|
|
|
|
|
// mVolHandler!!.postDelayed(mVolRunnable!!, (5 * 1000).toLong())
|
|
|
|
|
// true
|
|
|
|
|
// }
|
|
|
|
|
if (appLang == "ar") {
|
|
|
|
|
progressBarLayout!!.layoutDirection = View.LAYOUT_DIRECTION_RTL
|
|
|
|
|
}
|
|
|
|
|
@ -347,8 +354,9 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
|
|
|
|
|
|
|
|
|
|
override fun onError(session: Session, opentokError: OpentokError) {
|
|
|
|
|
Log.d(TAG, "onError: Error (" + opentokError.message + ") in session " + session.sessionId)
|
|
|
|
|
// Toast.makeText(requireContext(), "Session error. See the logcat please.", Toast.LENGTH_LONG).show()
|
|
|
|
|
// requireActivity().finish()
|
|
|
|
|
|
|
|
|
|
videoCallResponseListener?.errorHandle("onError: Error (" + opentokError.message + ") in session ")
|
|
|
|
|
dialog?.dismiss()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun onStreamReceived(session: Session, stream: Stream) {
|
|
|
|
|
@ -385,8 +393,8 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
|
|
|
|
|
|
|
|
|
|
override fun onError(publisherKit: PublisherKit?, opentokError: OpentokError) {
|
|
|
|
|
Log.d(VideoCallFragment.TAG, "onError: Error (" + opentokError.message + ") in publisher")
|
|
|
|
|
// Toast.makeText(requireContext(), "Session error. See the logcat please.", Toast.LENGTH_LONG).show()
|
|
|
|
|
// requireActivity().finish()
|
|
|
|
|
videoCallResponseListener?.errorHandle("onError: Error (" + opentokError.message + ") in publisher")
|
|
|
|
|
dialog?.dismiss()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun onVideoDataReceived(subscriberKit: SubscriberKit?) {
|
|
|
|
|
@ -408,6 +416,11 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
|
|
|
|
|
mSession!!.subscribe(mSubscriber)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun dismiss() {
|
|
|
|
|
videoCallResponseListener?.onCallFinished(1000)
|
|
|
|
|
super.dismiss()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun disconnectSession() {
|
|
|
|
|
if (mSession == null) {
|
|
|
|
|
videoCallResponseListener?.onCallFinished(Activity.RESULT_CANCELED)
|
|
|
|
|
@ -478,7 +491,6 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun setViewsVisibility() {
|
|
|
|
|
initUI(parentView)
|
|
|
|
|
val iconSize : Int = context!!.resources.getDimension(R.dimen.video_icon_size).toInt()
|
|
|
|
|
val iconSizeSmall : Int = context!!.resources.getDimension(R.dimen.video_icon_size_small).toInt()
|
|
|
|
|
val btnMinimizeLayoutParam : ConstraintLayout.LayoutParams = btnMinimize.layoutParams as ConstraintLayout.LayoutParams
|
|
|
|
|
@ -553,7 +565,6 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
|
|
|
|
|
|
|
|
|
|
btnMinimize.layoutParams = btnMinimizeLayoutParam
|
|
|
|
|
mCallBtn.layoutParams = mCallBtnLayoutParam
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun onCameraClicked(view: View?) {
|
|
|
|
|
|