![]() ![]() We also need to declare a reference to an AVAudioPlayer audioPlayer object and specify that the view controller class implements the AVAudioPlayerDelegate protocol. Since we will need to be able to read the current value of the volume slider control it will also be necessary to declare a corresponding outlet. The application is going to require action methods for the play and stop buttons in addition to the volume control. Playback may also be programmed to loop back and repeatedly play a specified number of times using the numberofLoops property. The length of the current audio playback may be obtained via the duration property whilst the current point in the playback is stored in the currentTime property. In addition, playback may be delayed to begin at a later time using the playAtTime instance method which takes as an argument the number of seconds (as an NSTimeInterval value) to delay before beginning playback. Similarly, the volume property may be used to adjust the volume level of the audio playback whilst the playing property may be accessed to identify whether or not the AVAudioPlayer object is currently playing audio. ![]() For example, the self explanatory play, pause and stop methods may be used to control playback. Once an AVAudioPlayer instance has been created the playback of audio may be controlled and monitored programmatically via the methods and properties of that instance. The current audio session is automatically activated and playback may be resumed by calling the play method of the corresponding AVAudioPlayer instance. audioPlayerEndInterruption: - Called after an interruption ends.Playback is automatically paused and the current audio session deactivated. audioPlayerBeginInterruption: – Called when audio playback has been interrupted by a system event such as an incoming phone call.An error object containing information about the nature of the problem is passed through to this method as an argument. audioPlayerDecodeErrorDidOccur: - Called when a decoding error is encountered by the AVAudioPlayer object during audio playback.An argument passed through to the method indicates whether the playback completed successfully or failed due to an error. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |