-
Notifications
You must be signed in to change notification settings - Fork 509
Use aac for voice messages #5898
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
Conversation
| this.audioStream.getTracks().forEach(track => track.stop()) | ||
| if (!this.aborted) { | ||
| this.blob = new Blob(this.chunks, { type: 'audio/mpeg-3' }) | ||
| this.blob = new Blob(this.chunks, { type: 'audio/mpeg; codecs=mp4a.40.2' }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as far I understand, if the type is audio/mpeg then the extension must be .m4a because then it's a mp4 container with only aac audio in it
if we want to use the ".aac" extension instead, the mimetype would be "audio/aac"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This trick is used by both the ios and the android app. But might be it doesn't work with browsers creating such files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The AudioPreview is shown only when the mimetype of the file starts with audio, so either the extension needs to be .m4a or .aac needs to be added to the server mimetype mappings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops... I did not refresh before writing; it is the same written below 🤷
|
from what I see we don't have the ".aac" extension mapped in the global mime type file. but in the mapping file it maps to "audio/mp4" which is yet another string |
|
We don't need to change anything in there server. Android and iOS mobile apps send this files already and they work pretty fine on all devices |
Signed-off-by: Marco Ambrosini <[email protected]>
4421ec6 to
a6c8c1c
Compare
|
Thanks for the help, works now :) |
| let time = today.getFullYear() + '-' + ('0' + today.getMonth()).slice(-2) + '-' + ('0' + today.getDay()).slice(-2) | ||
| time += ' ' + ('0' + today.getHours()).slice(-2) + '-' + ('0' + today.getMinutes()).slice(-2) + '-' + ('0' + today.getSeconds()).slice(-2) | ||
| return t('spreed', 'Talk recording from {time} ({conversation})', { time, conversation }) + '.mp3' | ||
| return t('spreed', 'Talk recording from {time} ({conversation})', { time, conversation }) + '.m4a' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now it's not marked as a voice message anymore roll eyes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also since m4a is not an audio file format, safari doesn't allow playing it in the audio tag.
|
So, we need to specify the mimeType on the MediaRecorder. The following works in Safari on iPad, but this works no where else nor does anything else work on Safari: this.mediaRecorder = new MediaRecorder(this.audioStream, {
audioBitsPerSecond: 128000,
videoBitsPerSecond: 0,
mimeType: 'video/mp4; codecs="mp4a.40.2"',
}) |
|
Safari recoring issue is fixed in #5902 But the files recorded with this PR here still don't play |
Hardcore alternate solutionWith If we can not:
|
application/octet-streaminstead ofaudio/mpegthus it doesn't display properly in the messageslistSigned-off-by: Marco Ambrosini [email protected]