Changes

Jump to: navigation, search

Playing Audio on iOS 9 using AVAudioPlayer

20 bytes removed, 20:34, 1 February 2016
m
Text replacement - "<google>BUY_IOS9</google>" to "<htmlet>ios9</htmlet>"
<googlehtmlet>BUY_IOS9ios9</googlehtmlet>
Playback may also be programmed to loop back and repeatedly play a specified number of times using the numberOfLoops property.
<googlehtmlet>BUY_IOS9ios9</googlehtmlet>
== Creating the Audio Example Application ==
.
</pre>
<googlehtmlet>BUY_IOS9ios9</googlehtmlet>
== Implementing the Action Methods ==
In the above code we create an NSURL reference using the filename and type of the audio file added to the project resources. Keep in mind that this will need to be modified to reflect the audio file used in your own projects.
<googlehtmlet>BUY_IOS9ios9</googlehtmlet>
Next, an AVAudioPlayer instance is created using the URL of the audio file. Assuming no errors were detected, the current class is designated as the delegate for the audio player object. Finally, a call is made to the audioPlayer object’s prepareToPlay method. This performs initial buffering tasks so that there is no buffering delay when the play button is subsequently selected by the user.
<googlehtmlet>BUY_IOS9ios9</googlehtmlet>

Navigation menu