@@ -54,7 +54,7 @@ interface ChannelCreateOptions {
5454 key ?: string ;
5555 /** Whether to enable WebRTC functionality */
5656 useWebRtc ?: boolean ;
57- useRecording ?: boolean ;
57+ recordingAddress ?: string | null ;
5858}
5959interface JoinResult {
6060 /** The channel instance */
@@ -106,7 +106,7 @@ export class Channel extends EventEmitter {
106106 issuer : string ,
107107 options : ChannelCreateOptions = { }
108108 ) : Promise < Channel > {
109- const { key, useWebRtc = true , useRecording = true } = options ;
109+ const { key, useWebRtc = true , recordingAddress } = options ;
110110 const safeIssuer = `${ remoteAddress } ::${ issuer } ` ;
111111 const oldChannel = Channel . recordsByIssuer . get ( safeIssuer ) ;
112112 if ( oldChannel ) {
@@ -116,7 +116,7 @@ export class Channel extends EventEmitter {
116116 const channelOptions : ChannelCreateOptions & {
117117 worker ?: Worker ;
118118 router ?: Router ;
119- } = { key, useRecording : useWebRtc && useRecording } ;
119+ } = { key, recordingAddress : useWebRtc ? recordingAddress : null } ;
120120 if ( useWebRtc ) {
121121 channelOptions . worker = await getWorker ( ) ;
122122 channelOptions . router = await channelOptions . worker . createRouter ( {
@@ -187,7 +187,7 @@ export class Channel extends EventEmitter {
187187 const now = new Date ( ) ;
188188 this . createDate = now . toISOString ( ) ;
189189 this . remoteAddress = remoteAddress ;
190- this . recorder = config . recording . enabled && options . useRecording ? new Recorder ( this ) : undefined ;
190+ this . recorder = config . recording . enabled && options . recordingAddress ? new Recorder ( this , options . recordingAddress ) : undefined ;
191191 this . key = key ? Buffer . from ( key , "base64" ) : undefined ;
192192 this . uuid = crypto . randomUUID ( ) ;
193193 this . name = `${ remoteAddress } *${ this . uuid . slice ( - 5 ) } ` ;
@@ -300,6 +300,7 @@ export class Channel extends EventEmitter {
300300 * @fires Channel#close
301301 */
302302 close ( ) : void {
303+ this . recorder ?. stop ( ) ;
303304 for ( const session of this . sessions . values ( ) ) {
304305 session . off ( "close" , this . _onSessionClose ) ;
305306 session . close ( { code : SESSION_CLOSE_CODE . CHANNEL_CLOSED } ) ;
0 commit comments