Swift 2.0 Programming Language Tutorial: AVFoundation : AVAudioPlayer , NSURL, NSBundle and more

Get our Auto Layout Course. Click below:
http://rshankar.com/courses/autolayoutyt1

Swift Programming Language Tutorial: AVFoundation : AVAudioPlayer , NSURL, NSBundle and more. This is the first in a series of AV or audio visual videos in Swift. In this video, we will develop a simple App that will play an mp3 file. We will be focusing Swift's AVFoundation framework which allows us to play sound files, record audio and much more.

Code:
=====
https://github.com/funzaAcademy/swift_play_audio_file

Script:
=======
Hello People and welcome. This is the first in a series of AV or audio visual videos in Swift.
We will be focusing Swift's AVFoundation framework which allows us to play sound files, record audio and much more.

In this video, we will develop a simple App that will play an mp3 file.
So here's the plan.
We will first download a freely available audio file from the web.
We will then add this file to our Xcode project. We will also add buttons to play, pause and stop this file.
And yeah, we will add a volume controller too.
Then we will write some code to bring bring this functionality to life.
So lets get going, shall we?

References:
========
https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVAudioPlayerClassReference/
https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/index.html#//apple_ref/swift/cl/c:objc(cs)NSURL
http://www.ioscreator.com/tutorials/play-music-avaudioplayer-ios8-swift
https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSBundle_Class/#//apple_ref/occ/clm/NSBundle/mainBundle
https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSBundle_Class/#//apple_ref/occ/instm/NSBundle/URLForResource:withExtension:
http://www.techotopia.com/index.php/Playing_Audio_on_iOS_8_using_AVAudioPlayer
https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/ErrorHandling.html
https://www.hackingwithswift.com/swift2
https://www.hackingwithswift.com/new-syntax-swift-2-error-handling-try-catch
http://www.ioscreator.com/tutorials/play-music-avaudioplayer-ios8-swift
https://www.safaribooksonline.com/library/view/ios-swift-game/9781491920794/ch04.html
https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVAudioPlayerClassReference/#//apple_ref/occ/instm/AVAudioPlayer/stop
http://jlmendezbonini.com/2013/03/27/Xcode-4-debugger-icons.html
Notes:
======

1. An instance of the AVAudioPlayer class, called an audio player, provides playback of audio data from a file or memory.
2. An NSURL object represents a URL that can potentially contain the location of a resource on a remote server, the path of a local file on disk,
or even an arbitrary piece of encoded data.
3. An NSBundle object represents a location in the file system that groups code and resources that can be used in a program
4. mainBundle() : The NSBundle object that corresponds to the directory where the application executable is located
4. Some operations are not guaranteed to always complete execution or produce a useful output .
As an example, consider the task of reading and processing data from a file on disk.
There are a number of ways this task can fail. Distinguishing among these different situations allows a program to resolve some errors
and to communicate to the user any errors it cant resolve.

Tools Used:
============
Microphone : Blue Yeti
Voice Editor : Audacity
Animation : Sparkol Video scribe
Illustrations: funza Academy + openclipart.org
Video editor + SFX : iMovie + ScreenFlow
Computer : MacBook Air
Content Creator: Sanjay Noronha
Posted by Mario 36441 in on June 08 at 12:12 AM  ·  Public

Comments (0)

No login
gif