-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Implementing the Audio Playback/Download on the chat #7900
base: main
Are you sure you want to change the base?
Implementing the Audio Playback/Download on the chat #7900
Conversation
Hello @panoramix360, Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here. |
This PR has been automatically labelled "stale" because it hasn't had recent activity. |
Added the possibility for download/preview of the audio file. But I'm not so sure if this is the right code for it, I don't know if it's already implemented, I did the same way that was implemented on the Documents File. So if any reviewer can help me clean this code or make it better, I'm available to fix it. I'll test on iOS and open the PR for review. Thanks! |
@panoramix360 I gave it a quick glance, and I don't see any big problems in reusing the code on the document file. In order to have things cleaner and get better reusability, I recommend you to create a custom hook. Something like How does that sound? Is there any other question? |
@larkox makes sense! I'll create it :D |
Hook created and migrated in the Thanks for the tip! Can you take a look now? I'm having some trouble running on iOS, I don't know what it could be, I managed to do the
Any ideas? Maybe updating my branch with |
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.
Great work! Some changes around the hook.
Yes. Update your branch with main, run |
hey @larkox just updated with the main branch and now it builds the application but after trying to run it says:
Weird, I'm trying to investigate it, thanks! EDIT: I was able to run it using Xcode directly, I don't know what may be wrong with the |
78c5a10
to
27abf39
Compare
I found a bug on the iOS version, try to fix it now. The player is not behaving like in Android, strange, after playing the audio it doesn't pause it anymore. |
Fixed, I need to fix it in a not-so-great way. Let me know what you think @larkox, it seems to be a known issue that was solved in new versions: |
This PR has been automatically labelled "stale" because it hasn't had recent activity. |
@panoramix360 There is a thing failing in the tests, related to the Once we have the CI all green, we can create a build and send to UX to do the first review on the "front-end" side. |
@larkox done! Thank you! |
This PR has been automatically labelled "stale" because it hasn't had recent activity. |
@panoramix360 pinging you just because the automation added the stale badge. You are still working on this, right? |
hey! Yep, I was making some code to the Seek method last week so we can deliver that in this PR as well. I managed to run the iOS build :D Will post updates this week for that so you guys can test it! I expect to have more time to contribute, it's being on/off :( |
@panoramix360 No problem. Take as much time as you need! Really happy to have you working on this. As I said, I just ping you because the bot keeps adding the stale badge 😛 |
8166049
to
8ab0e89
Compare
hey @enahum! Did something change in the way the application renders messages? The state update of the Before I did the merge, the duration was shown correctly and the state of the component was being updated correctly, but not anymore. I'm having problems with the My last commit implemented an onSeek method that is called using the PanResponder to get the location of the click so I can build the seek method as requested. But the Do you know something? I'll continue to investigate but figure I could get some help, thank you!! |
Just fixed the issue with the Progress + Width, I changed the width from a useState to the useSharedValue from react native reanimated, and it worked great! It seems the duration is being shown correctly just on iOS, so I'm trying to see what the issue could be. Really weird, because it was working on Android before and not on iOS, and now it's inverted haha I'll keep you guys posted. Thank you! |
The only thing I would say without even looking at the code is switch to use PanGesture from react-native-gesture-handler instead of the PanResponder |
@enahum it worked! The seek method is working now, thanks for the tip! This probably fixed all state management to work correctly with react native reanimated! Screen.Recording.2024-08-27.at.21.30.17.movJust one thing is not working when the user clicks on the bar here: It's triggering the touch for advancing to the specific message page: Do you have any ideas of how can I prevent that from happening just inside the progress bar? I probably need to call a stopPropagation or something like that, but I just wondering if you have an easy solution for that. I'll proceed with the other tasks and investigate that Thank you! EDIT: Just fixed the issue above wrapping the entire |
hey @larkox and @abhijit-singh I updated the PR to have the dragging on the Seek method, so the user now can drag the cursor to select a specific second. It's ready to be tested. Regarding your points:
I was not able to reproduce this issue, can you provide the audio file that you used in this case?
Can you try this one again? As I said above, the library was updated to the latest version, let's see if this is optimized more.
Done!
Done! Let me know about your review! Excited to have that merged :) |
@panoramix360 There seems to be some test failing. Can you look into that? |
Can you try again? I fixed in the code. |
@abhijit-singh Here should be the builds for this: |
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.
Thanks @panoramix360 and @larkox. I still see a few issues, more prominently on Android. Attaching recordings of the test on both Android and iOS. The first file in the recording is recorded and sent from iOS (M4A format) whereas the file sent second is recorded and sent from Android (AAC format).
Also thanks for taking the time to add in the scroll functionality! It seems a bit laggy right now. Is there any way to optimize that? Might be okay doing that as a follow up even.
Android recording:
https://github.com/user-attachments/assets/b8c4bc97-cc20-43c1-af32-9a489641f4bb
List of issues observed on Android:
- The second file in the attached recording never shows the duration. It plays normally and the duration increments as expected when played, but it does not show the duration upfront. I can see the duration in iOS though.
- If you tap on the message containing the audio to go to the thread view, the duration flickers to a long string for a second.
- Also in the thread view, neither files show the actual duration in the default view and instead show 00:00. It should be visible ideally even before the user clicks on play.
- On Android, I was not able to use the scroll functionality for the AAC file which was recorded and shared from that same device. I was able to scroll on both files on iOS though.
iOS recording:
https://github.com/user-attachments/assets/5cd36611-5ee9-4de7-86c4-5b2352d56705
- While most things are working as expected, it takes significantly longer to load the duration here. Especially when you go into the thread view, it takes a few seconds before the duration of the file loads.
- The scroll dot can seemingly be dragged off the screen which also makes the duration value negative. Ideally dragging beyond the scroll line or the file container should not be allowed. If we can't prevent that, we should try to bring it back to the start immediately even if someone drags it away. This seems to be happening on Android as well.
Thanks for the feedback @abhijit-singh! I'll take a look at those and fix it accordingly, I think overall it will be a polished and nice experience if we manage to solve all of this. Some of your issues are probably something related to the library we are using to load the audios, but I'll take a look at open issues there, like the duration issue on Android. The experience on iOS seems to be better, no idea why, will investigate it as well. Thank you! |
Summary
This is a work-in-progress PR that implements using the
react-native-video
library, the playback of audio on the mobile application. It uses theaudioOnly
prop to load audio using the library.Features implemented
Work to be done
Ticket Link
mattermost/mattermost#26290
Checklist
Device Information
This PR was tested on:
Screenshots
Android
iOS
Release Note