@@ -101,6 +101,8 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
101
101
/** options of room */
102
102
options : InternalRoomOptions ;
103
103
104
+ private _isRecording : boolean = false ;
105
+
104
106
private identityToSid : Map < string , string > ;
105
107
106
108
/** connect options of room */
@@ -332,6 +334,10 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
332
334
this . name = joinResponse . room ! . name ;
333
335
this . sid = joinResponse . room ! . sid ;
334
336
this . metadata = joinResponse . room ! . metadata ;
337
+ if ( this . _isRecording !== joinResponse . room ! . activeRecording ) {
338
+ this . _isRecording = joinResponse . room ! . activeRecording ;
339
+ this . emit ( RoomEvent . RecordingStatusChanged , joinResponse . room ! . activeRecording ) ;
340
+ }
335
341
this . emit ( RoomEvent . SignalConnected ) ;
336
342
} catch ( err ) {
337
343
this . recreateEngine ( ) ;
@@ -424,6 +430,13 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
424
430
this . connectFuture = undefined ;
425
431
}
426
432
433
+ /**
434
+ * if the current room has a participant with `recorder: true` in its JWT grant
435
+ **/
436
+ get isRecording ( ) {
437
+ return this . _isRecording ;
438
+ }
439
+
427
440
/**
428
441
* @internal for testing
429
442
*/
@@ -951,6 +964,10 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
951
964
952
965
private handleRoomUpdate = ( r : RoomModel ) => {
953
966
this . metadata = r . metadata ;
967
+ if ( this . _isRecording !== r . activeRecording ) {
968
+ this . _isRecording = r . activeRecording ;
969
+ this . emit ( RoomEvent . RecordingStatusChanged , r . activeRecording ) ;
970
+ }
954
971
this . emitWhenConnected ( RoomEvent . RoomMetadataChanged , r . metadata ) ;
955
972
} ;
956
973
@@ -1273,4 +1290,5 @@ export type RoomEventCallbacks = {
1273
1290
) => void ;
1274
1291
audioPlaybackChanged : ( playing : boolean ) => void ;
1275
1292
signalConnected : ( ) => void ;
1293
+ recordingStatusChanged : ( recording : boolean ) => void ;
1276
1294
} ;
0 commit comments