Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Writing an app to stream video to iPhone

Tags:

I'm interested in creating an iPhone app that can stream video from a central server, YouTube style. I was wondering if anyone has ever tried to do this before, what is the path of least resistant, existing APIs, etc? I really know nothing about how this is generally done. Would I be working with sockets? Just looking for some direction here. Thanks!

like image 807
Jameson Avatar asked Jun 04 '10 23:06

Jameson


People also ask

How do you project videos on iPhone?

In the iMovie app on your iPhone, tap Start New Project, then tap Movie. If you don't see Start New Project, tap Projects to return to the Projects browser.


1 Answers

If you have the streaming server up and ready, it is quite easy to implement a video controller that pops up youtube-style.

NSString *videoURLString = @"http://path-to-iphone-compliant-video-stream"; NSURL *videoURL = [NSURL URLWithString:videoURLString]; MPMoviePlayerController moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];  [moviePlayer prepareToPlay];  [moviePlayer play]; [self.view addSubview:moviePlayer.view]; 

You need to handle the controller that display the video player's view (which is self in this case).

In iOS 3.2+ MPMoviePlayerViewController make it even easier:

NSString *videoURLString = @"http://path-to-iphone-compliant-video-stream"; NSURL *videoURL = [NSURL URLWithString:videoURLString]; MPMoviePlayerViewController *moviePlayerView = [[[MPMoviePlayerViewController alloc] initWithContentURL:videoURL] autorelease]; [self presentMoviePlayerViewControllerAnimated:moviePlayerView]; 

presentMoviePlayerViewControllerAnimated is a MediaPlayer's additional method to FWViewController that you will find in iOS 3.2+ and it takes care of creating a view controller and pushing it on the stack, animating it with a slide-from-bottom animation, as in youtube.app.

like image 134
duhanebel Avatar answered Sep 30 '22 18:09

duhanebel