element-hq / element-android

A Matrix collaboration client for Android.
https://element.io/
GNU Affero General Public License v3.0
3.37k stars 717 forks source link

Send Audio files shared to element as m.audio instead of m.file #2521

Open DanHakimi opened 3 years ago

DanHakimi commented 3 years ago

Describe the bug

When sharing an audio file to element, the message sent is treated as m.file, a generic file message, instead of m.audio, an audio message.

To Reproduce

Share an aduio file from an external app to element. Note that the element web audio player does not function, since it doesn't recognize the message type as m.audio.

Expected behavior

An audio message would be recognized as such in element web, triggering the HTML5 audio player in the UI. (Incidentally, element-android and element-iOS should both have audio players, but that's a separate issue. They should also both have audio recording features, but that is yet another issue. And I'm too tired to fill out five more issues right now.)

Smartphone (please complete the following information): Android and iOS devices both seem to have this bug.

hex-m commented 3 years ago

Note that the element web audio player does not function

This is the issue tracker of the Android application, not Element Web.

I just tested sending an m4a file and the source of the message says m.audio on Element-Android and Element-Desktop. Can you please list the exact steps necessary to replicate the behavior?

An audio message would be recognized as such in element web, triggering the HTML5 audio player in the UI.

This is working for me. But again, are you having a problem with the Android App or the Web-App?

Possibly a duplicate of https://github.com/vector-im/element-android/issues/29?

DanHakimi commented 3 years ago

Well, hang on. I brought up some related issues on element-web, but a user there suggested that the reason the audio file would not play in the HTML5 audio player on element-web because element-android wasn't registering it as m.audio. I have minimal visibility into this situation, I really don't know which is to blame, but I know that a .m4a file sent from an android or iOS device and viewed on web does not trigger the audio player on web, and some piece of software is to blame for that.

Here is that thread: https://github.com/vector-im/element-web/issues/15945

I just tested sending an m4a file and the source of the message says m.audio on Element-Android and Element-Desktop. Can you please list the exact steps necessary to replicate the behavior?

I just found the view source and view decrypted source options on web and... I'm definitely getting m.file for m4a files . It also does not appear in my media on android, but in my files.

The only step seems to be the sending of a .m4a attachment in either mobile app. I'm having this issue with messages from multiple devices on both major mobile operating systems. I'm not sure why yours appears as m.audio

Possibly a duplicate of #29?

While I like that suggestion, the issue here is different.

hex-m commented 3 years ago

Thanks for the explanations. It's getting clearer but I'm still unable to reproduce so we'd need more details.

https://github.com/vector-im/element-web/issues/7370 sounds related and suggests it may depend on the browser that is used.

bmarty commented 3 years ago

When sending a mp3 file, even if I choose File in the attachment picker (instead of Audio), the sent message msgtype is m.audio, in clear or encrypted rooms. What can be improved in Element Android is to have an embedded player, I will create a dedicated issue to track that (EDIT: #2525).

I will try with a file with extension m4a.

DanHakimi commented 3 years ago

Sorry, I just realized what me and my friends are doing differently -- we use the sharing menu from our voice recording apps. It seems whtat, when audio files are shared to element, they are treated as files.

hex-m commented 3 years ago

@DanHakimi Shared a m4a file with Element (from the "Files"-App) and didn't have the problem you experience. Please list the exact steps and all software versions involved.

DanHakimi commented 3 years ago

@DanHakimi Shared a m4a file with Element (from the "Files"-App) and didn't have the problem you experience. Please list the exact steps and all software versions involved.

My friends are using the default iOS voice recorder app, and presumably a very recent version of Element. I'm not about to get them to submit a formal bug report here.

I shared audio from Voice Recorder 5.2.1 from Aurora Droid to Element 1.0.11 from Google Play. All on Android 11 on a Pixel 3aXL. This gives me an m.file. Adding the same message from Element results in m.audio. None of this appears to have anything to do with anything, since my friends have none of these factors in common, and they get the same error.