views:

1085

answers:

2

Hi,

I am researching video streaming for an iPhone application that I may have to write in the near future. The application does a whole lot other than stream video, but video aspect is the part that I have no experience with.

Anyone know of any good articles on writing streaming video apps?

Google seems to inundate me with links that have everything not to do what I seek.

Thanks,

m

+1  A: 

Apple provide good documentation on the media framework i ntheir docs.

Search for MPMoviePlayerController. The following sample code plays a movie from a URL. (disclaimer, this code lifted from Apple).

-(void)playMovieAtURL:(NSURL*)theURL 

{
    MPMoviePlayerController* theMovie=[[MPMoviePlayerController alloc] initWithContentURL:theURL]; 
    theMovie.scalingMode=MPMovieScalingModeAspectFill; 
    theMovie.userCanShowTransportControls=NO;

    // 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]; 
} 

// When the movie is done,release the controller. 
-(void)myMovieFinishedCallback:(NSNotification*)aNotification 
{
    MPMoviePlayerController* theMovie=[aNotification object]; 
    [[NSNotificationCenter defaultCenter] removeObserver:self 
                                                    name:MPMoviePlayerPlaybackDidFinishNotification 
                                                  object:theMovie]; 

    // Release the movie instance created in playMovieAtURL
    [theMovie release]; 
}
Roger Nolan
Thanks. I was somewhat aware of using the movieplayer, but was also wondering if there was libraries for creating a more integrated movie playing app. ie Have a small framed movie playing while still displaying my apps UI.
michael
Take a look at VLC. It is open source and has been ported to (Jailbroken) iPhone
Roger Nolan
A: 

Hi, I am looking at this issue as well. I would like to embed a video in an iPad app, something like how the Associated Press iPad application handles videos.

Apparently you can do this type of embedded video in OS 3.2 and later. Apple's documentation for MPMoviePlayerController describes how this can be done:

http://developer.apple.com/iphone/library/documentation/MediaPlayer/Reference/MPMoviePlayerController_Class/MPMoviePlayerController/MPMoviePlayerController.html