chrishubert / whatsapp-api

This project is a REST API wrapper for the whatsapp-web.js library, providing an easy-to-use interface to interact with the WhatsApp Web platform.
https://www.christophehubert.com
Other
911 stars 407 forks source link

Evaluation failed: Error: getAudioDuration: error loading audio #171

Open hlatki01 opened 9 months ago

hlatki01 commented 9 months ago

Hello, while trying to send a media using client/sendMessage/ with the body:

{
  "chatId": "PHONE@c.us",
  "contentType": "MessageMediaFromURL",
  "content": "https://samples-files.com/samples/Audio/mp3/sample-file-4.mp3"
}

I'm getting the following error:

{
  "success": false,
  "error": "Evaluation failed: Error: getAudioDuration: error loading audio\n    at new Error (<anonymous>:5:31)\n    at e (https://web.whatsapp.com/:2:4914)\n    at HTMLAudioElement.<anonymous> (https://web.whatsapp.com/app.1348daccac22f513cdcb.js:268:533788)"
}

The same happens if I try to get the file and send it in the base64 format, anyone know what should be done?

hlatki01 commented 8 months ago

anyone?

avoylenko commented 8 months ago

Have you tried to send an ogg encoded file?

hlatki01 commented 8 months ago

tried to send a base64 encoded ogg file, yes

avoylenko commented 8 months ago

Is it was like this https://github.com/chrishubert/whatsapp-api/issues/175#issuecomment-2005165933?

pawankray commented 8 months ago

Hello I have the same problem. Is it possible that it is from the web cache remote?

diegotranquilino commented 6 months ago

Same issue here. I received an advise from @avoylenko to switch from chromium to google chrome. Working in progress. If someone test ealier, please share with us.

jvkassi commented 5 months ago

i got it working, here is my quick dockerfile


FROM node:20

COPY --from=chrishubert/whatsapp-web-api /usr/src/app /usr/src/app
# Set the working directory
WORKDIR /usr/src/app

# Install Google Chrome and dependencies
ENV CHROME_BIN="/usr/bin/google-chrome" \
    PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true" \
    NODE_ENV="production"
RUN set -x \
    && apt-get update \
    && apt-get install -y \
    wget \
    gnupg \
    ca-certificates \
    fonts-liberation \
    udev \
    --no-install-recommends \
    && wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \
    && sh -c 'echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' \
    && apt-get update \
    && apt-get install -y google-chrome-stable \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Expose the port the API will run on
EXPOSE 3000

# Start the API
CMD ["npm", "start"]