Skip to content

Commit

Permalink
feat: convert audio with api
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidsonGomes committed Oct 22, 2024
1 parent c10680d commit e1de705
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2633,6 +2633,7 @@ export class BaileysStartupService extends ChannelStartupService {

public async processAudio(audio: string): Promise<Buffer> {
if (process.env.API_AUDIO_CONVERTER) {
this.logger.verbose('Using audio converter API');
const formData = new FormData();

if (isURL(audio)) {
Expand All @@ -2652,6 +2653,7 @@ export class BaileysStartupService extends ChannelStartupService {
throw new InternalServerErrorException('Failed to convert audio');
}

this.logger.verbose('Audio converted');
return Buffer.from(data.audio, 'base64');
} else {
let inputAudioStream: PassThrough;
Expand Down

0 comments on commit e1de705

Please sign in to comment.