ios - Can't get movie to finish within loop -


i want movie play there objects in array, want make sure movie has finished playing each time.

here's -simplified- code i'd expect that:

- (void)loopthrougharray {          [array enumerateobjectsusingblock:^(id obj, nsuinteger idx, bool *stop) {             nslog (@"index = %i", idx);              movieplayercontroller = [[mpmovieplayercontroller alloc] initwithcontenturl:url];              [[nsnotificationcenter defaultcenter] addobserver:self                                                      selector:@selector(movieplaybackdidfinish:)                                                          name:mpmovieplayerplaybackdidfinishnotification                                                        object:movieplayercontroller];             [movieplayercontroller play];           }];     }];  }   - (void) movieplaybackdidfinish:(nsnotification*)notification {     movieplayercontroller = [notification object];     [[nsnotificationcenter defaultcenter] removeobserver:self                                                     name:mpmovieplayerplaybackdidfinishnotification                                                   object:movieplayercontroller];      nslog(@"movie playback finished"); } 

unfortunately, code runs through loop, after plays movie, seen in logs:

 index = 0  index = 1  index = 2  index = 3  index = 4  index = 5  movie playback finished 

what doing wrong?

thanks insights


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -