I have a video in my application which plays within a MPMoviePlayerViewController. I want to know if it is possible to reset the MPMoviePlayerViewController when a button is pressed. At the moment, if the user taps Done whilst the video is playing and then tries to watch the video again it continues where they left off. This is causing a few problems with some of my other code and I would like it to start from the beginning. Is this possible?
I would like the video to reset itself when the Done button is pressed, so that it is ready for next time.
I have a function and would like to add the reset of the video in here.
func doneButtonClick(sender:NSNotification?) {
let value = UIInterfaceOrientation.Portrait.rawValue
UIDevice.currentDevice().setValue(value, forKey: "orientation")
}
Tell your video to
stop. Then callplaywhen you want to play the video again. This will initiate playback from the beginning of the video.MPMediaPlayback Protocol Reference