当互联网速度缓慢时,MPMoviePlayerController会加载一半的屏幕

时间:2015-12-01 07:36:45

标签: ios swift avfoundation mpmovieplayercontroller

我在我的应用程序中使用MPMoviePlayerController进行流播放。当互联网连接速度较慢时,它会在很长一段时间后加载,但它会将播放器加载到屏幕的一半而不是self.view.bounds,并以黑屏开始播放。

经过的时间正在运行但是我得到了黑屏但是控件仍在那里。

var url:NSURL = NSURL(string: "movieurl")!
self.moviePlayer = MPMoviePlayerController()
self.moviePlayer.movieSourceType = MPMovieSourceType.Streaming
self.moviePlayer = MPMoviePlayerController(contentURL: url)
self.moviePlayer.prepareToPlay()
self.moviePlayer.shouldAutoplay = true
self.moviePlayer.stop()
self.moviePlayer.view.frame = self.view.bounds
self.view.addSubview(self.moviePlayer.view)
self.moviePlayer.fullscreen = true
self.moviePlayer.setFullscreen(true, animated: true)
self.moviePlayer.controlStyle = MPMovieControlStyle.Embedded
self.moviePlayer.scalingMode = MPMovieScalingMode.AspectFit
self.moviePlayer.play()

0 个答案:

没有答案