@@ -39,12 +39,14 @@ public class Room: NSObject, Loggable {
3939 @objc
4040 public var name : String ? { _state. name }
4141
42+ /// Room's metadata.
4243 @objc
4344 public var metadata : String ? { _state. metadata }
4445
4546 @objc
4647 public var serverVersion : String ? { _state. serverVersion }
4748
49+ /// Region code the client is currently connected to.
4850 @objc
4951 public var serverRegion : String ? { _state. serverRegion }
5052
@@ -57,13 +59,18 @@ public class Room: NSObject, Loggable {
5759 @objc
5860 public var activeSpeakers : [ Participant ] { _state. activeSpeakers }
5961
62+ /// If the current room has a participant with `recorder:true` in its JWT grant.
63+ @objc
64+ public var isRecording : Bool { _state. isRecording }
65+
6066 // expose engine's vars
6167 @objc
6268 public var url : String ? { engine. _state. url }
6369
6470 @objc
6571 public var token : String ? { engine. _state. token }
6672
73+ /// Current ``ConnectionState`` of the ``Room``.
6774 public var connectionState : ConnectionState { engine. _state. connectionState }
6875
6976 /// Only for Objective-C.
@@ -91,6 +98,8 @@ public class Room: NSObject, Loggable {
9198 var remoteParticipants = [ Sid: RemoteParticipant] ( )
9299 var activeSpeakers = [ Participant] ( )
93100
101+ var isRecording : Bool = false
102+
94103 @discardableResult
95104 mutating func getOrCreateRemoteParticipant( sid: Sid , info: Livekit_ParticipantInfo ? = nil , room: Room ) -> RemoteParticipant {
96105
@@ -152,6 +161,7 @@ public class Room: NSObject, Loggable {
152161 // don't notify if empty string (first time only)
153162 ( oldState. metadata == nil ? !metadata. isEmpty : true ) {
154163
164+ // proceed only if connected...
155165 self . engine. executeIfConnected { [ weak self] in
156166
157167 guard let self = self else { return }
@@ -161,6 +171,19 @@ public class Room: NSObject, Loggable {
161171 }
162172 }
163173 }
174+
175+ // isRecording updated
176+ if state. isRecording != oldState. isRecording {
177+ // proceed only if connected...
178+ self . engine. executeIfConnected { [ weak self] in
179+
180+ guard let self = self else { return }
181+
182+ self . delegates. notify ( label: { " room.didUpdate isRecording: \( state. isRecording) " } ) {
183+ $0. room ? ( self , didUpdate: state. isRecording)
184+ }
185+ }
186+ }
164187 }
165188 }
166189
@@ -373,6 +396,7 @@ extension Room: SignalClientDelegate {
373396 $0. metadata = joinResponse. room. metadata
374397 $0. serverVersion = joinResponse. serverVersion
375398 $0. serverRegion = joinResponse. serverRegion. isEmpty ? nil : joinResponse. serverRegion
399+ $0. isRecording = joinResponse. room. activeRecording
376400
377401 if joinResponse. hasParticipant {
378402 $0. localParticipant = LocalParticipant ( from: joinResponse. participant, room: self )
@@ -389,7 +413,10 @@ extension Room: SignalClientDelegate {
389413 }
390414
391415 func signalClient( _ signalClient: SignalClient , didUpdate room: Livekit_Room ) -> Bool {
392- _state. mutate { $0. metadata = room. metadata }
416+ _state. mutate {
417+ $0. metadata = room. metadata
418+ $0. isRecording = room. activeRecording
419+ }
393420 return true
394421 }
395422
0 commit comments