@@ -71,7 +71,7 @@ class WsChatClient extends BaseWsChatClient {
7171 this . wavStreamPlayer ?. setMediaStream ( rawMediaStream ) ;
7272
7373 // init stream player
74- await this . wavStreamPlayer ?. add16BitPCM ( new ArrayBuffer ( 0 ) , this . trackId ) ;
74+ // await this.wavStreamPlayer?.add16BitPCM(new ArrayBuffer(0), this.trackId);
7575
7676 // 2. recording
7777 await this . recorder . record ( {
@@ -140,8 +140,6 @@ class WsChatClient extends BaseWsChatClient {
140140 const ws = await this . init ( ) ;
141141 this . ws = ws ;
142142
143- const sampleRate = await this . recorder ?. getSampleRate ( ) ;
144-
145143 const event : ChatUpdateEvent = {
146144 id : chatUpdate ?. id || uuid ( ) ,
147145 event_type : WebsocketsEventType . CHAT_UPDATE ,
@@ -167,8 +165,12 @@ class WsChatClient extends BaseWsChatClient {
167165 if ( this . config . voiceId ) {
168166 setValueByPath ( event , 'data.output_audio.voice_id' , this . config . voiceId ) ;
169167 }
170- // 强制设置输入音频的采样率为系统默认的采样率
171- setValueByPath ( event , 'data.input_audio.sample_rate' , sampleRate ) ;
168+
169+ setValueByPath (
170+ event ,
171+ 'data.input_audio.sample_rate' ,
172+ event . data ?. input_audio ?. sample_rate || 48000 ,
173+ ) ;
172174
173175 this . inputAudioCodec = event . data ?. input_audio ?. codec || 'pcm' ;
174176 this . outputAudioCodec = event . data ?. output_audio ?. codec || 'pcm' ;
0 commit comments