swift - Not able to play a mp3 in iOS -


document directory url

file:///var/mobile/containers/data/application/895de1a3-5d2e-462b-8d13-518b7cafc6c7/documents/146791.mp3 

code using play url

do {        print(url)         audioplayer = try avaudioplayer.init(contentsof: url, filetypehint: avfiletypempeglayer3)        guard let player = audioplayer else { return }         player.preparetoplay()        player.play()     } catch let error {         print(error.localizeddescription)     } 

error getting

the operation couldn’t completed. (osstatus error 1685348671.)

swift 3

do {             let player = try avaudioplayer(contentsof: url!)              player.volume = 0.6             player.preparetoplay()             player.play()          }         catch {             print("file not found")         } 

Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -