@@ -5,18 +5,17 @@ import LiveKitComponents
55/// - Note: If both are unavailable, the view will show a placeholder visualizer.
66struct AgentParticipantView : View {
77 @EnvironmentObject private var session : Session
8- @Environment ( \. agent) private var agent
98 @Environment ( \. namespace) private var namespace
109 /// Reveals the avatar camera view when true.
1110 @SceneStorage ( " videoTransition " ) private var videoTransition = false
1211
1312 var body : some View {
1413 ZStack {
15- if let avatarVideoTrack = agent? . avatarVideoTrack {
14+ if let avatarVideoTrack = session . agent. avatarVideoTrack {
1615 SwiftUIVideoView ( avatarVideoTrack)
1716 . clipShape ( RoundedRectangle ( cornerRadius: . cornerRadiusPerPlatform) )
1817 . aspectRatio ( avatarVideoTrack. aspectRatio, contentMode: . fit)
19- . padding ( . horizontal, agent? . avatarVideoTrack? . aspectRatio == 1 ? 4 * . grid : . zero)
18+ . padding ( . horizontal, session . agent. avatarVideoTrack? . aspectRatio == 1 ? 4 * . grid : . zero)
2019 . shadow ( radius: 20 , y: 10 )
2120 . mask (
2221 GeometryReader { proxy in
@@ -31,15 +30,15 @@ struct AgentParticipantView: View {
3130 . onAppear {
3231 videoTransition = true
3332 }
34- } else if let audioTrack = agent? . audioTrack {
33+ } else if let audioTrack = session . agent. audioTrack {
3534 BarAudioVisualizer ( audioTrack: audioTrack,
36- agentState: agent? . state ?? . listening,
35+ agentState: session . agent. agentState ?? . listening,
3736 barCount: 5 ,
3837 barSpacingFactor: 0.05 ,
3938 barMinOpacity: 0.1 )
4039 . frame ( maxWidth: 75 * . grid, maxHeight: 48 * . grid)
4140 . transition ( . opacity)
42- } else if session. isReady {
41+ } else if session. isConnected {
4342 BarAudioVisualizer ( audioTrack: nil ,
4443 agentState: . listening,
4544 barCount: 1 ,
@@ -48,7 +47,7 @@ struct AgentParticipantView: View {
4847 . transition ( . opacity)
4948 }
5049 }
51- . animation ( . snappy, value: agent? . audioTrack? . id)
50+ . animation ( . snappy, value: session . agent. audioTrack? . id)
5251 . matchedGeometryEffect ( id: " agent " , in: namespace!)
5352 }
5453}
0 commit comments