chat-sdk-android icon indicating copy to clipboard operation
chat-sdk-android copied to clipboard

How do i delete an audio message after it's been sent?

Open RyanElliott94 opened this issue 9 years ago • 13 comments

Hello again,

My app sends audio only or audio with text but that's causes one massive problem and that is the message list becomes extremely slow! so i need to delete every audio message after the user and friend has played the message once or twice but the way the audio message is saved then sent is confusing me.

I have looked at the code which sends and saves the message but from what I've seen, i have no idea what the best way would be to delete the message?

Also i did pay for the audio module, so i haven't added audio message myself!

Oh and i feel like i have improved the way audio messages are recorded and sent because the standard way just wasn't the best as you could cancel the recording or anything like that so if any of the SDK devs want the code then let me know!

Thanks

RyanElliott94 avatar Mar 14 '17 15:03 RyanElliott94

Hi @SimplisticApps,

The audio messages shouldn't make the app go more slowly as it is just an image message with addition information available. The message is sent as normal and when the user clicks play the audio URL is downloaded and played.

The cells also shouldn't be loaded if they are not on screen meaning that, at any one time, only 3-6 messages should be being loaded.

It would be good to understand how your app is fitting together. Is your app based around sending large amounts of audio messages or do users send them as they would with a normal chat app.

Simon

simonsmiley64 avatar Mar 14 '17 22:03 simonsmiley64

The app is simply a normal messaging app but instead of just text messages with an attachment, the user can only send audio messages or audio with text attached, which means the whole conversation list will consist of audio messages with or without text but because of that, the whole list is really slow after sending about 5 audio messages

RyanElliott94 avatar Mar 14 '17 22:03 RyanElliott94

Okay so i have had an extra look and it looks like the audio file gets uploaded to the server and the cache directory and when you play the message, it will read from the cache rather than server but because every audio message is uploaded to cache and read from cache it makes the entire message list extremely slow which is a massive problem as my app is all about sending audio messages! I tried also enabling SaveAudioToDir to see if that helped but it doesn't so what i need to know is how to ONLY upload and read the url of the sent audio file to the server or at the very least to temporally upload the message to cache then delete it afterwards so it can read from the server!

Seems confusing so hope you understand what i mean!

Thanks

RyanElliott94 avatar Mar 16 '17 15:03 RyanElliott94

Hey! I have a bit of time right now, and the problem seems clear. I'll see if I can find a quick modification to dump the old audio messages from the cache.

Is this issue only found in the Android SDK?

-- Kyle

kykrueger avatar Mar 16 '17 15:03 kykrueger

Other than features, there isn't any other issues but the same does go with sending images and videos but again that is only an issue when loads are sent in one conversation

RyanElliott94 avatar Mar 16 '17 15:03 RyanElliott94

@kykrueger Had any luck yet?

RyanElliott94 avatar Mar 16 '17 17:03 RyanElliott94

Unfortunately not, I am having some trouble with my emulator at the moment. Might need to take a better look this weekend. However, if the performance issue is across both SDKs, im just going to tag @bensmiley and @simonsmiley64 to see if I could get their opinions if we could make this change on both SDKs.

kykrueger avatar Mar 16 '17 17:03 kykrueger

Okay, fair enough! I'll keep looking myself to see if i come up with anything.

Hopefully a solution will be found and as always thanks for the help

RyanElliott94 avatar Mar 16 '17 17:03 RyanElliott94

Right i don't know if this will of any use but i looked at the logcat while i was running my app through my phone and i had a lot of this: I/Choreographer: Skipped 86 frames! The application may be doing too much work on its main thread. coming up, it's not always 86 frames but i do think it could be partly why the app runs so slowly! I've only noticed it come up on the conversation activity

RyanElliott94 avatar Mar 16 '17 18:03 RyanElliott94

Right I'm confident that i have successfully fixed the issue. It looks like MediaPlayer was slowing it right down! So instead of playing the audio internally, it now opens a default player and the list is not only smoother but the messages send in under a second whereas before, it would take nearly a minute to send.

The reason why i think it was all to do with the MediaPlayer is because when you watch the LogCat when running the app, it is doing way to much and takes up a lot of resources!

RyanElliott94 avatar Mar 20 '17 21:03 RyanElliott94

Would it be possible for you to send me code changes you made? [email protected] Then we could improve the main codebase. If you do, we can give you a gift voucher to set against further add-ons.

bensmiley avatar Mar 21 '17 03:03 bensmiley

Done, it's been sent with the subject "ChatBubbleAudioView.java changes"

RyanElliott94 avatar Mar 21 '17 13:03 RyanElliott94

Fixes on #46

bensmiley avatar Mar 22 '17 05:03 bensmiley