xcode - AVPlayer not working iOS Swift -
i'm trying play external html video avplayer reason can't work. i've been trying read every question none of suggested answers seems work. i've tried find if has been changed swift 3 or xcode 8.0 no luck.
is code wrong or need else make work? enable in capabilities or similar?
let url = nsurl(fileurlwithpath: "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4") let player = avplayer(url: url url) let playerviewcontroller = avplayerviewcontroller() playerviewcontroller.player = player playerviewcontroller.view.frame = cgrect(x: 0, y: 0, width: 100, height: 200) self.view.addsubview(playerviewcontroller.view) self.addchildviewcontroller(playerviewcontroller) player.play()
try: let url = nsurl(string:"your_url")
string:
produces nsurl represents string given. string "http://www.google.com" , url represents http://www.google.com.
fileurlwithpath:
takes path, not url, , produces nsurl represents path using file:// url. if give /foo/bar/baz url represent file:///foo/bar/baz.
Comments
Post a Comment