Analysis of Music app (example: QQ music)

Source: Internet
Author: User

< a > The core function of QQ music is Play the song .

Play the audio, first think can use avfoundation frame, to complete the main function of playing music. But Avfoundation can only play local music and not play it online. Although you can download the resources from the network to the local re-play, but must be the whole song to download the complete before playing, so the effect is not good.

!

If you want to play online, you can choose the Audio Queue service in the Audiotoolbox framework. The Audio queue service can complete audio recording and playback.


A. Frequency service queue The audio queue has three components:

Three buffers buffers: each buffer is a temporary warehouse where audio data is stored.

A buffer queue: An ordered queue that contains an audio buffer.

A callback callback: a custom queue callback function.


The process of audio playback:

The audio is read into the buffer, once a buffer is filled and then placed in the buffer queue, and then continue to populate the other buffers, when the playback starts, the first buffer to read the audio playback, once played, the callback function will be triggered to start playing the next buffer audio, Fills the first buffer at the same time, fills it up and then puts it back into the buffer queue again.


Streaming media

All right? Music player to ensure the smooth playback, must be side loading side play, if done better, you can use streaming media to do.

Detailed content ...

< two > get the song list, show it in the field?

this part mainly through the AFN to get the song information from the network, and then display on the interface. For the interface show this part is more familiar, do not make it difficult. continue to add


< three > song download to local storage

Song offline download management This part is also very important. The song name, author and other related information can be stored in the database, the song's source files and lyrics files, downloaded and saved to the folder specified in the sandbox.


< four > Other features such as other settings are similar to other software.

Can be compared to QQ player, pick their own familiar places detailed explanation of how to achieve.


Analysis of Music app (example: QQ music)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.