Media send not see preview as we send it manually
as I use the following code to send media
issue
- PDF does not send with the name even if i pass filename [for PDF i used base64 code]
- on image send not get preview before download
// if get media direact URL messageContent = { [mediaType]: { url: image, mimetype: mimeType, fileName: file_name, }, caption, };
// if get base64 messageContent = { [mediaType]: mediaBuffer, mimetype: mimeType, fileName: file_name, caption, }; }
console.log("messageContent :>> ", messageContent);
const sendResult = await wpClient.sendMessage(
`${number}@c.us`,
messageContent
);
using the above code i was able o send media but not get blurred preview in WhatsApp chat for more ref i attached a screenshot if any one have an idea how to do that and
send using Script
send Manully
Install npm install sharp jimp in your application, it'll work
I'm facing the same issue while sending video messages unable to view video thumbnail, it is same like above @tls-jil mentioned in screenshots. I noticed that both sharp and jimp are already installed in the app (as seen in package.json), so video preview should work automatically as mentioned by @freefugga freefugga. But still it is not working. Inputs mediatype": "video", "mimetype":"video/mp4", url : any public url
Appreciate any inputs or suggestions on this!
Okay , Actually i am using evolution-api which internally uses bailey module , We are installing ffmpeg in evolution module which run on same container. So the preview should work as expected right ? @Akkun3704
When sending video messages using Baileys, the video thumbnails were not displaying correctly on mobiles. Instead of showing the expected preview, a gray box(andriod) or mediaImage(static in IOS) was displayed, indicating that the thumbnail missing.
Root Cause:
In the prepareMediaMessage method (around line 2657) of the whatsapp.bailey.service.ts file, the code responsible for setting the jpegThumbnail for video message, in the below context thumbnail was assigned from static image for which it is sending a static image all time to every video message.
**Previous Implementation: **
if (mediaMessage.mediatype === 'video') {
prepareMedia[mediaType].jpegThumbnail = Uint8Array.from(
readFileSync(join(process.cwd(), 'public', 'images', 'video-cover.png')),//static image
);
}
This approach attempted to set a static thumbnail image for video messages but was removed.
Resolution:
To address this issue we have removed assigning image data to jpegThumbnail, the following changes were made:
if (mediaMessage.mediatype === 'video') {
prepareMedia[mediaType].gifPlayback = false;
}
for the above code , we are not assigning any image data to jpegThumbnail , then thumbnail preview is working as expected.
My question is why we are generating base64 data from static image and assigning to jpegThumbnail ? Is there any reason behind that?
@freefugga