-1

I have MPMoviePlayerController and it start with url but it doesn't resume after pausing, I don't know how to resume after successful buffer of video. Please help me. Thanks in advance.

I tried with this

self.moviePlayer = MPMoviePlayerViewController(contentURL: url)
                self.moviePlayer?.moviePlayer.prepareToPlay()
                self.moviePlayer?.moviePlayer?.movieSourceType = MPMovieSourceType.Unknown
                self.moviePlayer?.moviePlayer.play()
                self.presentMoviePlayerViewControllerAnimated(self.moviePlayer)
Gopal Devra
  • 564
  • 2
  • 5
  • 24

1 Answers1

1

You can use MPMoviePlayerPlaybackStateDidChangeNotification to get notified for state change. Then check MPMoviePlaybackState for desired state and resume your video. For more reference you can refer to apple document for MPMoviePlayerController. Also set its shouldAutoplay property to YES.

Also checkout this answer in case your self.moviePlayer is not working properly because it is getting out of scope. Try using it as a member variable.

Community
  • 1
  • 1
Akshay Sunderwani
  • 12,428
  • 8
  • 29
  • 52
  • Thanks, Akshay it's working for getting event on state of MPMoviePlayer,but i think i need to implement buffer implementation for run a video from a url. Do you have any code that work for buffering of video. – Gopal Devra Aug 25 '15 at 13:01
  • There is no need to add extra code to implement buffering of video it will be handled by this procedure only. – Akshay Sunderwani Aug 28 '15 at 04:45
  • Ok, Thanks I've added the code to play video in the pause state after every 10 seconds of interval. – Gopal Devra Aug 28 '15 at 05:39