swift program to get files from url to play as well as for download -
i'm want play files url, , url saved in array , play them online .
no idea how appreciable.
fatal error coming
`override func viewdidload() { super.viewdidload()
let url = nsurl(string: "http://royalwap.net/48-740090s/na%20na%20na%20na.mp3")
let urlrequest = nsurlrequest( url: url! )
var error: nserror? = nil nsurlconnection.sendasynchronousrequest(urlrequest, queue: nsoperationqueue(), completionhandler: {response, data , error in if error != nil { println("there error") } else { self.player = avaudioplayer(contentsofurl: url , error: nil ) self.player.play() }}) }`
use avplayer stream audio url, wont able avaudioplayer unless download it.
let url = nsurl(string: "http://royalwap.net/48-740090s/na%20na%20na%20na.mp3")! let playeritem = avplayeritem(url: url) player = avplayer(playeritem: playeritem) player.play()
Comments
Post a Comment