Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import AVFoundation
- class Music1ViewController: UIViewController {
- //5 -
- var songPlayer = AVAudioPlayer()
- //15 -
- var hasBeenPaused = false
- //6 -
- func prepareSongAndSession() {
- do {
- //7 - Insert the song from our Bundle into our AVAudioPlayer
- songPlayer = try AVAudioPlayer(contentsOf: URL.init(fileURLWithPath: Bundle.main.path(forResource: "localsong", ofType: "mp3")!))
- //8 - Prepare the song to be played
- songPlayer.prepareToPlay()
- songPlayer = try AVAudioPlayer(contentsOf: URL(string: "https://s3.amazonaws.com/kargopolov/kukushka.mp3")!)
Add Comment
Please, Sign In to add comment