Skip to content

Commit 23b589b

Browse files
committed
fix: TypeScript compilation errors for waveform feature
- Use getChannelData(0) instead of channelData[0] for AudioBuffer API - Add type casting to suppress AnyMessageContent type error for waveform property
1 parent 3ac8d44 commit 23b589b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3052,7 +3052,7 @@ export class BaileysStartupService extends ChannelStartupService {
30523052
private async getAudioWaveform(audioBuffer: Buffer): Promise<number[]> {
30533053
try {
30543054
const audioData = await audioDecode(audioBuffer);
3055-
const samples = audioData.channelData[0]; // Get first channel
3055+
const samples = audioData.getChannelData(0); // Get first channel
30563056
const waveformLength = 64;
30573057
const samplesPerWaveform = Math.floor(samples.length / waveformLength);
30583058

@@ -3098,7 +3098,7 @@ export class BaileysStartupService extends ChannelStartupService {
30983098

30993099
const result = this.sendMessageWithTyping<AnyMessageContent>(
31003100
data.number,
3101-
{ audio: convert, ptt: true, mimetype: 'audio/ogg; codecs=opus', seconds, waveform },
3101+
{ audio: convert, ptt: true, mimetype: 'audio/ogg; codecs=opus', seconds, waveform } as any,
31023102
{ presence: 'recording', delay: data?.delay },
31033103
isIntegration,
31043104
);

0 commit comments

Comments
 (0)