|
|||
|
Streaming video using the SDK is incredibly easy thanks to the MPMoviePlayerController class. To start playing a movie just run this code below:
Code:
NSURL *myMovieURL = // NSURL that points to a file locally or on the internet. MPMoviePlayerController* theMovie = [ [ MPMoviePlayerController alloc ] initWithContentURL: myMovieURL ]; // Initialize a MPMoviePlayerController object with the movie. theMovie.scalingMode = MPMovieScalingModeAspectFill; // Set the scaling mode to fill the screen with the movie. [ [ NSNotificationCenter defaultCenter ] addObserver: self selector: @selector(movieFinishedCallback:) name: MPMoviePlayerPlaybackDidFinishNotification object: theMovie ]; // Add an observer so we can be told when the movie has finished playing. [ theMovie play ]; Code:
- (void)movieFinishedCallback:(NSNotification *)notification;
{
[ [ NSNotificationCenter defaultCenter] removeObserver: self name: MPMoviePlayerPlaybackDidFinishNotification object: [ notification object ] ];
[ [ notification object ] release ]; // Release the object that sent the notification which is our theMovie object.
}
|
|
|||
|
I'm not sure if this would work, but one thing you can try on the moviePlayer callback isPlaybackFinished, (or whatever the delegate method's name is) Get the notification object and send the message start back to the movie.
I'll try it later and see if it works. |
|
|||
|
If the fading is the problem, then maybe paste a UIView overlay with a background color to match your MPMoviePlayerController when beginning the movie.
However after thinking about it the bigger problem would be, that the moviePlayBackDidFinish NSNotification*)notificati on delegate call happens anytime the movie stops. Even if you click done halfway through. |
|
|||
|
I was wondering if there was a possibility of having a movie be played in the middle of a UIView and have a button affect the movie, have it replay the movie or a different one altogether.
Basically im looking to have an animated character on a UIView and I was hoping to use videos that i have of the character to have him demonstrate different functions. Would this be possible ? |
![]() |
| Thread Tools | |
| Display Modes | |
|
|