mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-14 01:41:24 -06:00
feat: convert audio with api
This commit is contained in:
parent
c10680df41
commit
e1de70542b
@ -2633,6 +2633,7 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
|
|
||||||
public async processAudio(audio: string): Promise<Buffer> {
|
public async processAudio(audio: string): Promise<Buffer> {
|
||||||
if (process.env.API_AUDIO_CONVERTER) {
|
if (process.env.API_AUDIO_CONVERTER) {
|
||||||
|
this.logger.verbose('Using audio converter API');
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
|
|
||||||
if (isURL(audio)) {
|
if (isURL(audio)) {
|
||||||
@ -2652,6 +2653,7 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
throw new InternalServerErrorException('Failed to convert audio');
|
throw new InternalServerErrorException('Failed to convert audio');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.logger.verbose('Audio converted');
|
||||||
return Buffer.from(data.audio, 'base64');
|
return Buffer.from(data.audio, 'base64');
|
||||||
} else {
|
} else {
|
||||||
let inputAudioStream: PassThrough;
|
let inputAudioStream: PassThrough;
|
||||||
|
Loading…
Reference in New Issue
Block a user