iphone - Switching view controllers at the end of a movie's playback? -
in app, there's uibutton end user can push, pushes view controller plays video in frame using mpmovieplayercontroller.
i'd able detect when video reaches it's end, , when happens, push new view controller. though can't seem find code can this.
does know how this?
the video playback code looks this:
//video stuff cgrect myvideorect = cgrectmake(0.0f, 145.0f, 320.0f, 160.0f); movieurl = [[nsbundle mainbundle] urlforresource:@"mymovie" withextension:@"m4v"]; movieplayercontroller = [[mpmovieplayercontroller alloc] initwithcontenturl:movieurl]; [[movieplayercontroller view] setframe:myvideorect]; movieplayercontroller.controlstyle = mpmoviecontrolstylenone; [self.view addsubview:movieplayercontroller.view]; [movieplayercontroller play]; thanks!
register view controller listen playbackdidfinish notification player:
[[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(playbackfinished:) name:mpmovieplayerplaybackdidfinishnotification object:player]; then implement playbackfinished method can push new view controller or perform other action.
Comments
Post a Comment