Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio cannot be played on mobile #517

Open
Ngebab opened this issue Dec 11, 2023 · 1 comment
Open

Audio cannot be played on mobile #517

Ngebab opened this issue Dec 11, 2023 · 1 comment

Comments

@Ngebab
Copy link

Ngebab commented Dec 11, 2023

Hello so I tried sending an audio using bytes.
It works but only for whatsapp web and whatsapp desktop, when I tried to play it on my phone it would make no audio

this is my code (Im using wasock which is whatsmeow with added feature)

audioUploaded, err := msg.Client.Upload(context.Background(), body, waSocket.MediaAudio)
				if err != nil {
					msg.ReplyError("Error While Uploading Media to WhatsApp Server")
					return
				}
				content := &waProto.Message{

					AudioMessage: &waProto.AudioMessage{
						ContextInfo:   msg.NewContext(true),
						Url:           proto.String(audioUploaded.URL),
						Ptt:           proto.Bool(true),
						DirectPath:    proto.String(audioUploaded.DirectPath),
						Mimetype:      proto.String("audio/ogg; codecs=opus"),
						FileLength:    proto.Uint64(audioUploaded.FileLength),
						FileSha256:    audioUploaded.FileSHA256,
						FileEncSha256: audioUploaded.FileEncSHA256,
						MediaKey:      audioUploaded.MediaKey,
					},
				}
				msg.Reply(content)
@hoehermann
Copy link
Contributor

The official phone app is very picky about the audio format. Setting the mime-type and hoping for the best is not enough. It must absolutely be an ogg container with the opus compression at 16 kHz and exactly one channel. I recommend using ffmpeg: ffmpeg -i yourinput -ac 1 -ar 16000 -c:a libopus voicemessage.ogg. I had users trying to send an MP3 or AAC file. This cannot be expected to work (even if other clients can support more formats due to auto-detection).
Reports from iOS users indicate, that values for the waveform diagram must be supplied for the message to be regarded as a "ptt" voice message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants