iOS 9: Using AVPlayerViewController Swift. (crossed out play button) -


i'm having trouble playing video content on both ios device , in simulator.

goal: stream video online resource given here: public video streams using hls using avplayerviewcontroller, learn how works.

this consistently resulted in no errors being thrown, view controller presenting me view.

avplayerviewcontroller

i decided step , test on local resource, filmed short screen capture in quicktime (.m4v) , saved right project. resulted in exact same behavior no errors reported.

here code (avkit , avfoundation imported ):

var playervc : avplayerviewcontroller! var playeritem : avplayeritem! var player : avplayer! var playerlayer: avplayerlayer!  override func viewdidappear(animated: bool) {      let bundle = nsbundle.mainbundle()     let path = bundle.pathforresource("testvideos", oftype: "m4v")     let url = nsurl.init(string: path!)      playeritem = avplayeritem.init(url: url!)     player = avplayer.init(playeritem: playeritem)     playervc = avplayerviewcontroller.init();     playervc.player = player;      self.presentviewcontroller(playervc, animated: true) { () -> void in         self.playervc.player?.play()     } } 

seeing warning when building ipadmini 4: <catransformlayer: 0x136ea1030> - changing property maskstobounds in transform-only layer, have no effect

xcode: version 7.1 targeting: ios 9.0

update nasty constraint output avplayerviewcontroller. don't think contributing, here is:

2015-10-28 15:12:02.777 avkittest[4441:94545] unable simultaneously satisfy constraints. @ least 1 of constraints in following list 1 don't want. try this: (1) @ each constraint , try figure out don't expect; (2) find code added unwanted constraint or constraints , fix it. (note: if you're seeing nsautoresizingmasklayoutconstraints don't understand, refer documentation uiview property translatesautoresizingmaskintoconstraints) ( "", "", "", "", "", "", "", "" )

turns out silly, had change:

let url = nsurl.init(string: path!) playeritem = avplayeritem.init(url: url!)

with:

let url = nsurl.init(fileurlwithpath: path!) let playeritem = avplayeritem.init(url: url)


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -