Reputation: 3
I am using storyboards in XCODE4.
I am currently able to launch a video from a table cell using a push segue from a tableview controller to a viewcontroller. When the segue gets called, the view controller immediately launches the video using standard media player code in viewdidload. My problem is once the video is over, the app doesn't return to the table cell, instead it stays at the blank table view controller until a user clicks "Back". Anyone know a simple way to have the video end and switch back to the TableViewController?
Upvotes: 0
Views: 494
Reputation: 89509
Apple didn't make this one easy. My assumption is that they want the user to choose to exit the movie player when s/he feels comfortable enough to do it (and then the user would have the choice to replay or skip back to parts that they might want to see again).
But one way to catch the end of the movie happening would be to register for the "MPMoviePlayerPlaybackDidFinishNotification
" notification (documentation linked for you) and then exit and/or remove the MPMoviePlayerController.
Note: this notification also fires if there's any error while loading the movie (see the documentation for initWithContentURL:
).
Upvotes: 1