[Reading Notes] iOS-stream audio and Pandora Radio, ios-pandora

Source: Internet
Author: User

[Reading Notes] iOS-stream audio and Pandora Radio, ios-pandora

Complexity is inevitable and will only increase over time. Therefore, when adding features, you must set aside time for restructuring and code simplification. Do not worry about performance before encountering problems. The iPhone is very strong and you may never encounter unexpected performance problems.

 

When transmitting audio to a device over the Internet, two transmission models can be used: Stream Transmission and download.

 

For stream transmission, the audio server transmits bytes over the network at the audio bit rate. For example, if the audio is encoded in 64 Kbits/s, it is foreseeable that this rate (64 kbit/s) will be used during stream transmission ). streaming audio is often used for continuous and uninterrupted music streams.

 

If audio transmission uses a download model, music is divided into discrete data blocks (for example, one song is transferred at a time ). the customer downloads and plays a data block as quickly as possible, and starts downloading the next data block only when the first data block is about to be downloaded.

 

Various models have their advantages and disadvantages. Streaming Transmission requires less client memory overhead (data is consumed once transmitted), and the customer's implementation complexity is lower (at the cost of higher server complexity ). However, in a program, stream transmission is more likely to damage audio due to network latency and packet loss. On the other hand, the downloaded audio content overhead is greater (because the audio segment may be quite large), and the client complexity is also greater. However, the downloaded audio is more immune to network damage, because the network bandwidth can be fully utilized rather than limited to a fixed amount.

 

To achieve this feature, you need to know how many bytes of the song has been played so far, and save this information when the application ends, in addition, when the application is started, a part of the songs will be downloaded to resume interruption from the offset position at the exit.

 

 

Reference: amazing iPhone cool development-seven first-line experts programming and design examples

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.