Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AN-1563] Low layer selected for video while screen share #705

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package live.hms.roomkit.ui.meeting.commons

import android.content.Context
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
Expand Down Expand Up @@ -29,6 +28,7 @@ import live.hms.roomkit.ui.theme.applyTheme
import live.hms.roomkit.ui.theme.getColorOrDefault
import live.hms.roomkit.ui.theme.setBackgroundAndColor
import live.hms.roomkit.util.*
import live.hms.video.media.settings.HMSLayer
import live.hms.video.media.tracks.HMSLocalVideoTrack
import live.hms.video.media.tracks.HMSRemoteVideoTrack
import live.hms.video.media.tracks.HMSVideoTrack
Expand Down Expand Up @@ -111,6 +111,10 @@ abstract class VideoGridBaseFragment : Fragment() {
Log.d("VGBF"," (screenshar : ${isScreenshare()}) grid row count ${gridRowCount} else column count ${gridColumnCount}")
}

fun isDocked(): Boolean {
return gridRowCount == 1 && gridColumnCount == 2 && isScreenshare().not()
}

protected val maxItems: Int
get() = gridRowCount * gridColumnCount

Expand Down Expand Up @@ -190,6 +194,8 @@ abstract class VideoGridBaseFragment : Fragment() {
item: MeetingTrack,
scalingType: RendererCommon.ScalingType = RendererCommon.ScalingType.SCALE_ASPECT_BALANCED
) {

val isAutoSimulcastEnabled = if (isDocked()) false else meetingViewModel.isAutoSimulcastEnabled()
Log.d(TAG,"bindSurfaceView for :: ${item.peer.name}")
val earlyExit = item.video == null
|| item.video?.isMute == true
Expand All @@ -198,7 +204,11 @@ abstract class VideoGridBaseFragment : Fragment() {
item.video?.let { track ->
if (isScreenshare()) view.setScalingType( RendererCommon.ScalingType.SCALE_ASPECT_FIT)
view.addTrack(track)
view.disableAutoSimulcastLayerSelect(meetingViewModel.isAutoSimulcastEnabled())

view.disableAutoSimulcastLayerSelect(isAutoSimulcastEnabled)
if (track is HMSRemoteVideoTrack && isDocked()) {
track.setLayer(HMSLayer.LOW)
}
if (item.video?.isDegraded == true ) binding.hmsVideoView.hide() else binding.hmsVideoView.show()
binding.hmsVideoView.setOnLongClickListener {
(it as? HMSVideoView)?.let { videoView -> openDialog(videoView, item.video, item.peer.name.orEmpty()) }
Expand Down