Reputation: 1513
i'm try to Play the Video with Swift. i use this code to change UIController
var vc = playVideoOne()
self.presentViewController(vc, animated: true, completion: nil)
this is my PlayVideo Code
var audioplayer:MPMoviePlayerController=MPMoviePlayerController()
var url:NSURL = NSURL(string: "http://dev.fjuts.com:83/test.mp4")!
self.audioplayer.contentURL = url
audioplayer.play()
self.view.addSubview(audioplayer.view)
but the Video Sound is output. Video is not output.
Upvotes: 0
Views: 997
Reputation: 71854
change your function like this:
var audioplayer : MPMoviePlayerController!
var url:NSURL = NSURL(string: "http://dev.fjuts.com:83/test.mp4")
audioplayer = MPMoviePlayerController(contentURL: url)
audioplayer.view.frame = CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: self.view.frame.size.height)
audioplayer.view.sizeToFit()
audioplayer.play()
self.view.addSubview(audioplayer.view)
audioplayer.fullscreen = true
audioplayer.controlStyle = MPMovieControlStyle.Embedded
May be this can help you..
Upvotes: 1