mercredi 25 mars 2015

How to play video with AVPlayer?

I am using AVPlayer to play a video. But I can not set the Layer of video to be on full screen on iPhone 4s. Is there any difference on iPhone 4s?


Here is what I do:



var playerItem = AVPlayerItem(URL: NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("demo_video", ofType: "mp4")!))
var player = AVPlayer(playerItem: playerItem)
var playerLayer = AVPlayerLayer(player: player)
playerLayer.frame = self.view.frame
self.view.layer.addSublayer(playerLayer)


Thanks




Aucun commentaire:

Enregistrer un commentaire