I decided to have a play with AVAudioPlayer in a Swift Playground. The following code works fine in a normal Swift project, but returns the following error when running it in a Playground (in the assistant editor):
2015-05-12 00:08:04.374 AVAudioFile[2481:141158] 00:08:04.374 ERROR: AVAudioFile.mm:266: AVAudioFileImpl: error -54
Here is the code:
import Cocoa
import AVFoundation
var audioFileURL = NSURL(fileURLWithPath: "/Users/scooby/Desktop/song.wav")
var error: NSError?
var audioFile = AVAudioFile(forReading: audioFileURL, error: &error)
Printing the error out comes with:
Error Domain=com.apple.coreaudio.avfaudio Code=-54 "The operation couldn’t be completed. (com.apple.coreaudio.avfaudio error -54.)" UserInfo=0x7fa8c0736f70 {failed call=ExtAudioFileOpenURL((CFURLRef)fileURL, &_extAudioFile)}
Just can't figure out why its only an error in a Playground. Any ideas at all?
Thanks!