[WIP] Video chats

This commit is contained in:
Isaac
2024-09-06 21:41:16 +08:00
parent 3aceee1696
commit ccedf9fc06
9 changed files with 1533 additions and 147 deletions

View File

@@ -41,6 +41,7 @@ final class VideoChatParticipantVideoComponent: Component {
let isSpeaking: Bool
let isExpanded: Bool
let bottomInset: CGFloat
weak var rootVideoLoadingEffectView: VideoChatVideoLoadingEffectView?
let action: (() -> Void)?
init(
@@ -50,6 +51,7 @@ final class VideoChatParticipantVideoComponent: Component {
isSpeaking: Bool,
isExpanded: Bool,
bottomInset: CGFloat,
rootVideoLoadingEffectView: VideoChatVideoLoadingEffectView?,
action: (() -> Void)?
) {
self.call = call
@@ -58,6 +60,7 @@ final class VideoChatParticipantVideoComponent: Component {
self.isSpeaking = isSpeaking
self.isExpanded = isExpanded
self.bottomInset = bottomInset
self.rootVideoLoadingEffectView = rootVideoLoadingEffectView
self.action = action
}
@@ -113,6 +116,8 @@ final class VideoChatParticipantVideoComponent: Component {
private var activityBorderView: UIImageView?
private var loadingEffectView: PortalView?
override init(frame: CGRect) {
super.init(frame: frame)
@@ -429,6 +434,18 @@ final class VideoChatParticipantVideoComponent: Component {
self.videoSpec = nil
}
if self.loadingEffectView == nil, let rootVideoLoadingEffectView = component.rootVideoLoadingEffectView {
if let loadingEffectView = PortalView(matchPosition: true) {
self.loadingEffectView = loadingEffectView
self.addSubview(loadingEffectView.view)
rootVideoLoadingEffectView.portalSource.addPortal(view: loadingEffectView)
loadingEffectView.view.frame = CGRect(origin: CGPoint(), size: availableSize)
}
}
if let loadingEffectView = self.loadingEffectView {
transition.setFrame(view: loadingEffectView.view, frame: CGRect(origin: CGPoint(), size: availableSize))
}
if component.isSpeaking && !component.isExpanded {
let activityBorderView: UIImageView
if let current = self.activityBorderView {