Basic-Video-Broadcasting icon indicating copy to clipboard operation
Basic-Video-Broadcasting copied to clipboard

maxVideoSession 6 people.

Open zubingala opened this issue 4 years ago • 1 comments

I'm trying to implement maxVideoSession = 6. But, sometimes when 3 or more people join cannot see third view. Can someone help me here.

func updateBroadcastersView() {
        // video views layout
        if videoSessions.count == maxVideoSession {
            broadcastersView.reload(level: 0, animated: true)
        } else {
            var rank: Int
            var row: Int
            
            if videoSessions.count == 0 {
                broadcastersView.removeLayout(level: 0)
                return
            } else if videoSessions.count == 1 {
                rank = 1
                row = 1
            } else if videoSessions.count == 2 {
                rank = 1
                row = 2
            } else if videoSessions.count == 3 {
                rank = 2
                row = 1
            } else if videoSessions.count == 4{
                rank = 2
                row = 2
            }
            else {
                rank = 2
                row = Int(ceil(Double(videoSessions.count) / Double(rank)))
            }
            
            let itemWidth = CGFloat(1.0) / CGFloat(rank)
            let itemHeight = CGFloat(1.0) / CGFloat(row)
            let itemSize = CGSize(width: itemWidth, height: itemHeight)
            let layout = AGEVideoLayout(level: 0)
                .itemSize(.scale(itemSize))
            
            broadcastersView
                .listCount { [unowned self] (_) -> Int in
                    return self.videoSessions.count
                }.listItem { [unowned self] (index) -> UIView in
                    return self.videoSessions[index.item].hostingView
                }
            
            broadcastersView.setLayouts([layout], animated: true)
        }
    }

zubingala avatar Dec 22 '21 20:12 zubingala

sorry for late reply. where did you call setupRemoteView?

plutoless avatar Feb 08 '22 06:02 plutoless