Skip to content

Instantly share code, notes, and snippets.

@neror
Created February 2, 2010 21:19
Show Gist options
  • Select an option

  • Save neror/293040 to your computer and use it in GitHub Desktop.

Select an option

Save neror/293040 to your computer and use it in GitHub Desktop.
-(void)playMovieAtURL:(NSURL*)theURL {
MPMoviePlayerController* theMovie = [[MPMoviePlayerController alloc] initWithContentURL:theURL];
theMovie.scalingMode = MPMovieScalingModeAspectFill;
theMovie.movieControlMode = MPMovieControlModeHidden;
// Register for the playback finished notification.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(myMovieFinishedCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:theMovie];
// Movie playback is asynchronous, so this method returns immediately.
[theMovie play];
UIWindow *movieWindow = [[UIApplication sharedApplication] keyWindow];
UILabel *label = [[[UILabel alloc] initWithFrame:CGRectZero] autorelease];
label.textColor = [UIColor whiteColor];
label.transform = CGAffineTransformMakeRotation(M_PI/2.0);
label.frame = CGRectMake(290.f,0.f,30.f,480.f);
label.backgroundColor = [UIColor colorWithRed:0.f green:0.f blue:0.f alpha:.5f];
label.text = @"Can you see me?";
[movieWindow addSubview:label];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment