Created
November 13, 2016 19:07
-
-
Save ahmadnaser/a4589152d0c7ae5fe44094e3647c7e5f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Shared on Ahmad Naser.com | |
func PlayAudioInSwift3() { | |
var player = AVAudioPlayer() | |
let audioPath = Bundle.main().pathForResource("2-loader", ofType: "mp3") | |
do { | |
try player = AVAudioPlayer(contentsOf: URL(fileURLWithPath: audioPath!)) | |
player.play() | |
} catch { | |
// process error | |
} | |
Thread.sleep(forTimeInterval: 1) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment