M
M
moved_on2014-09-18 01:03:02
Java
moved_on, 2014-09-18 01:03:02

How to implement cropping mp3 file in android application?

Native application for android.
Task - After selecting an mp3 file, before uploading it to the server, you need to cut it to a maximum length of 30 seconds (create a track preview).
Are there ready-made libraries for solving the problem? If yes, please share, I will be grateful. Or an example of what to read, how to solve, any advice.
We must not forget that we need to make a beautiful activity - we need to get the length of the track, select graphically the area that we leave for sending to the server and cut it off.
And from above, another question is how to implement file upload to the php server. What request to send? It is desirable - a code example. Only the piece of code that is executed in the doinbackground AsyncTask function is allowed.
Thank you very much for your time.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2014-09-18
@moved_on

https://code.google.com/p/mp3fenge/ - makes clippings.
the duration of the track can be found out from the metadata, but usually this is done by enumeration of all frames (if this case is encoded with a variable bitrate). The task is quite common. There are also a lot of solutions. Moreover, similar open-source projects are lying around on the net, look.
If it is very easy to do, POST request in multipart/form-data (the file in the body of the request is encoded in base64, there are enough examples). But you can do it more complicated (sending directly binary data, you can in pieces), since PHP has no problems with reading the request body. So here's what you come up with.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question