2021-03-06 17:56:41.069 2475-3124/com.example.app I/org.webrtc.Logging: EglRenderer: local_video_viewDropping frame - No surface
That's the error/warning I am experiencing. And the remote/local video track is not rendering in QBRTCSurfaceView.
fun onCreateView() {
....
binding?.remoteVideoView?.init(QBRTCClient.getInstance(requireContext()).eglContext.eglBaseContext, null)
binding?.remoteVideoView?.setZOrderMediaOverlay(true)
binding?.localVideoView?.init(QBRTCClient.getInstance(requireContext()).eglContext.eglBaseContext, null)
binding?.localVideoView?.setZOrderMediaOverlay(true)
return binding?.root
}
//region QBRTCClientVideoTracksCallbacks
override fun onLocalVideoTrackReceive(qbrtcSession: QBRTCSession?, videoTrack: QBRTCVideoTrack) {
localVideoTrack = videoTrack
localVideoTrack?.let {
binding?.localVideoView?.let { v ->
fillVideoView(v, videoTrack)
}
}
}
override fun onRemoteVideoTrackReceive(session: QBRTCSession?, videoTrack: QBRTCVideoTrack, userID: Int?) {
remoteVideoTrack = videoTrack
binding?.remoteVideoView?.let { v ->
fillVideoView(v, videoTrack)
}
}
private fun fillVideoView(videoView: QBRTCSurfaceView?, videoTrack: QBRTCVideoTrack) {
videoTrack.cleanUp()
if (videoView != null) {
videoTrack.addRenderer(videoView)
updateVideoView(videoView)
}
}
private fun updateVideoView(videoView: SurfaceViewRenderer) {
val scalingType = RendererCommon.ScalingType.SCALE_ASPECT_FILL
videoView.setScalingType(scalingType)
videoView.setMirror(false)
videoView.requestLayout()
}
Here's an update on my question:
So, do QBRTCSurfaceViews work in a single activity application, inside a fragment that is of type "BottomSheetDialogFragment"?
I have a single activity app, with a MainFragment, and when I push a new Fragment (FragmentB) with NavDirections, then display a BottomSheetDialogFragment (FragmentC) which contains the QBRTCSurfaceView; The QBRTCSurfaceViews do not render the local(partially) or remote track, instead only the red background of the QBRTCSurfaceViews. But the bottom the local track is being rendered, but it's only showing part of the render.
Local Track phone is Samsung SM-S111DL. Remote Track Phone is Google Pixel 2.
The Local Track is only rendering on the part off the phone screen that has the home & up buttons (which is outside of the MainActivity so this is odd).
Does this means I have to display the QBRTCSurfaceView inside the 1st child fragment of an activity?
Such as: MainActivity to display the CallActivity->FirstFragment-> QBRTCSurfaceViews
Currently I have: MainActivity -> Multiple Fragments using nav_graph -> the i push a BottomSheetDialogFragment that contains the QBRTCSurfaceViews
Also, the audio works 100% fine and all the Quickblox callbacks are firing correctly, just the render is being cut off on the local, and the remote render isn't showing, and I believe it's because my QBRTCSurfaceViews are not inside the 1st child fragment, of the Activity as with the Quickblox example.
I checked the example, and the example app is not a single activity application. Meaning it's not following the latest recommended best practices when creating android apps. If I need to display a CallingActivity, then a Fragment, then add my QBRTCSurfaceViews to that Fragment, that's fine, but the documentation doesn't tell the Users of this limitation. Also, do QBRTCSurfaceViews work wtih BottomSheetDialogFragment? https://docs.quickblox.com/docs/android-video-calling
I found my answer, if you are having issue with QBRTCSurfaceViews, check android SurfaceView options to configure based on your setup https://developer.android.com/reference/android/view/SurfaceView