Hi All,
I'm streaming video to the iPhone and don't like the way MPMoviePlayerController handles things at the beginning. I noticed that when you click on the row to select a particular movie the app just sits there until it is loaded sufficiently to play it. So I popped in a UIImageView with a loading image and a nice spinner to keep the user informed.
I think they should have the option to cancel the play back of the movie if they get tired of waiting. So I've got a cancel button with a background image.
UIButton *cancel;
UIImage *cancelImage = [UIImage imageNamed:@"cancel.png"];
cancel = [UIButton buttonWithType:UIButtonTypeCustom];
cancel.frame = CGRectMake(0,0, cancelImage.size.width, cancelImage.size.height);
cancel.center = CGPointMake(35, 20);
[cancel setImage:cancelImage forState:UIControlStateNormal];
[cancel addTarget:self action:@selector(cancelMovie) forControlEvents:UIControlEventTouchUpInside];
[moviePreviewView addSubview:cancel];
But I'm not sure what to put in the cancelMovie method. I've tried duplicating what I have in the moviePlayBackDidFinish call back method but it crashes rather spectacularly.
I also tried:
-(void)cancelMovie {
[theMovie.view removeFromSuperview];
[theMovie release];
}
But that doesn't do anything good either. I was thinking I could call the moviePlayBackDidFinish directly but I don't think you can call a notification method directly.
Your thoughts?