@@ -53,7 +53,7 @@ interface ChannelCreateOptions {
5353 key ?: string ;
5454 /** Whether to enable WebRTC functionality */
5555 useWebRtc ?: boolean ;
56- useRecording ?: boolean ;
56+ recordingAddress ?: string | null ;
5757}
5858interface JoinResult {
5959 /** The channel instance */
@@ -105,7 +105,7 @@ export class Channel extends EventEmitter {
105105 issuer : string ,
106106 options : ChannelCreateOptions = { }
107107 ) : Promise < Channel > {
108- const { key, useWebRtc = true , useRecording = true } = options ;
108+ const { key, useWebRtc = true , recordingAddress } = options ;
109109 const safeIssuer = `${ remoteAddress } ::${ issuer } ` ;
110110 const oldChannel = Channel . recordsByIssuer . get ( safeIssuer ) ;
111111 if ( oldChannel ) {
@@ -115,7 +115,7 @@ export class Channel extends EventEmitter {
115115 const channelOptions : ChannelCreateOptions & {
116116 worker ?: Worker ;
117117 router ?: Router ;
118- } = { key, useRecording : useWebRtc && useRecording } ;
118+ } = { key, recordingAddress : useWebRtc ? recordingAddress : null } ;
119119 if ( useWebRtc ) {
120120 channelOptions . worker = await getWorker ( ) ;
121121 channelOptions . router = await channelOptions . worker . createRouter ( {
@@ -186,7 +186,7 @@ export class Channel extends EventEmitter {
186186 const now = new Date ( ) ;
187187 this . createDate = now . toISOString ( ) ;
188188 this . remoteAddress = remoteAddress ;
189- this . recorder = config . recording . enabled && options . useRecording ? new Recorder ( this ) : undefined ;
189+ this . recorder = config . recording . enabled && options . recordingAddress ? new Recorder ( this , options . recordingAddress ) : undefined ;
190190 this . key = key ? Buffer . from ( key , "base64" ) : undefined ;
191191 this . uuid = crypto . randomUUID ( ) ;
192192 this . name = `${ remoteAddress } *${ this . uuid . slice ( - 5 ) } ` ;
@@ -291,6 +291,7 @@ export class Channel extends EventEmitter {
291291 * @fires Channel#close
292292 */
293293 close ( ) : void {
294+ this . recorder ?. stop ( ) ;
294295 for ( const session of this . sessions . values ( ) ) {
295296 session . off ( "close" , this . _onSessionClose ) ;
296297 session . close ( { code : SESSION_CLOSE_CODE . CHANNEL_CLOSED } ) ;
0 commit comments