whatsapp-api icon indicating copy to clipboard operation
whatsapp-api copied to clipboard

Evaluation failed: Error: getAudioDuration: error loading audio

Open hlatki01 opened this issue 1 year ago • 8 comments

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

{
  "chatId": "[email protected]",
  "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 avatar Mar 05 '24 22:03 hlatki01

anyone?

hlatki01 avatar Mar 27 '24 23:03 hlatki01

Have you tried to send an ogg encoded file?

avoylenko avatar Mar 28 '24 19:03 avoylenko

tried to send a base64 encoded ogg file, yes

hlatki01 avatar Mar 28 '24 21:03 hlatki01

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

avoylenko avatar Mar 28 '24 21:03 avoylenko

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

pawankray avatar Mar 31 '24 11:03 pawankray

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.

diegotranquilino avatar Jun 05 '24 00:06 diegotranquilino

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"]

jvkassi avatar Jun 12 '24 02:06 jvkassi