in AmazonChimeSDKDemo/AmazonChimeSDKDemo/VideoTileCell.swift [30:68]
func updateCell(name: String, isSelf: Bool, videoTileState: VideoTileState?, tag: Int) {
let isVideoActive = videoTileState != nil
let isVideoPausedByUser = isVideoActive && videoTileState?.pauseState == .pausedByUserRequest
attendeeName.text = name
backgroundColor = .systemGray
isHidden = false
// Self video cell not active
if isSelf, !isVideoActive {
onTileButton.isHidden = true
videoDisabledImage.image = UIImage(named: "meeting-video")?.withRenderingMode(.alwaysTemplate)
videoDisabledImage.tintColor = .white
videoDisabledImage.isHidden = false
return
}
videoDisabledImage.isHidden = true
videoRenderView.isHidden = false
videoRenderView.accessibilityIdentifier = "\(name) VideoTile"
onTileButton.tintColor = .white
onTileButton.isHidden = false
onTileButton.tag = tag
onTileButton.addTarget(self, action: #selector(onTileButtonClicked), for: .touchUpInside)
onTileButton.isSelected = isVideoPausedByUser
if isSelf {
onTileButton.setImage(UIImage(named: "switch-camera")?.withRenderingMode(.alwaysTemplate),
for: .normal)
} else {
onTileButton.setImage(UIImage(named: "pause-video")?.withRenderingMode(.alwaysTemplate),
for: .normal)
onTileButton.setImage(UIImage(named: "resume-video")?.withRenderingMode(.alwaysTemplate),
for: .selected)
let shouldShowPoorConnection = videoTileState?.pauseState == .pausedForPoorConnection
renderPoorConnection(isHidden: !shouldShowPoorConnection)
}
}