I am accessing the songs using MPMediaItem from iPod Library and saving the assetURL in my coredata then I am using the following code to play the sound but it doesn't plays the sound.
var url = NSURL.fileURLWithPath(file as String)
print("FILE : \(file) \n")
var error: NSError?
var itemPlayer:AVPlayer?
// itemPlayer = AVPlayer(URL: NSURL(fileURLWithPath: file as String))
itemPlayer = AVPlayer(playerItem: AVPlayerItem(URL: NSURL(fileURLWithPath: file as String)))
itemPlayer!.play()
and it just print the following but player is not playing the song
FILE : ipod-library://item/item.mp3?id=4287130341014298234
And also if i use AVAudioPlayer to initialize player using above assetURL then it return me Nil. and i think this is because the above url is not local it should be like file://.... . So what should i do to play sound using assetURL of song from iPod Library