PDA

View Full Version : Streaming Video using MPMoviePlayerController




Fontano
Jul 17, 2008, 10:21 AM
For the last week or so, I have been trying to get MPMoviePlayerController working with streaming video feeds...

No luck.

I am using the MoviePlayer sample as the base...
And I have been working with the movieURL function, to change the source video.

I have been successfully at access video outside of the package, on the local hard drive, and on network access drives... but not streaming to an HTTP or an RTSP.

My latest attempt, was altering the line in movieURL (in MyViewController.m) to
NSString *moviePath = @"http://www.itc.virginia.edu/network/videotest/when-lg.mov";

When the app plays, I get an on screen of:
This Movie Could Not Be Played

The Debug/Log reports:
2008-07-17 10:20:12.194 MoviePlayer[4395:20b] ERROR! Please file a bug report!
2008-07-17 10:20:12.195 MoviePlayer[4395:20b] Could not play the movie http://www.itc.virginia.edu/network/videotest/when-lg.mov. We received the AVController_ItemFailedToPlayNotification with info: Error Domain=NSOSStatusErrorDomain Code=-12783 UserInfo=0x1083d20 "This movie could not be played."


Any ideas on how to go getting this to work?



cwoloszynski
Oct 16, 2008, 06:13 AM
Any chance you figured this out? I am seeing the same pop-up but I don't get the notification you do? Would you be willing to share the Notification registration code you used to get it?

Fontano
Oct 16, 2008, 10:48 AM
Any chance you figured this out? I am seeing the same pop-up but I don't get the notification you do? Would you be willing to share the Notification registration code you used to get it?

I was able to access Movies via HTTP progressive download.
I have not returned to accessing a true streaming server, the files I have been able to access where complete video files on the server.

IIRC, I posted this when I was having a problem with the player.
Which ultimately ended up being an incompatibility issue with the DiVX codec/player being installed (The actual one from www.divx.com)

The other Problem I was having at the time, is that I didn't change the URL building to use a URL link instead of a local file.

However, at the end of the work, it did work in the simulator, but not the device. And priorities have shifted, so I haven't returned to getting the streaming video to play.

developer.in
Nov 5, 2008, 02:38 AM
I was able to access Movies via HTTP progressive download.
I have not returned to accessing a true streaming server, the files I have been able to access where complete video files on the server.

IIRC, I posted this when I was having a problem with the player.
Which ultimately ended up being an incompatibility issue with the DiVX codec/player being installed (The actual one from www.divx.com)

The other Problem I was having at the time, is that I didn't change the URL building to use a URL link instead of a local file.

However, at the end of the work, it did work in the simulator, but not the device. And priorities have shifted, so I haven't returned to getting the streaming video to play.

Hi Fontano

Can you please explain how you achieved it? Are you saving the whole file locally and then playing it?

CommanderData
Nov 5, 2008, 06:11 AM
For the last week or so, I have been trying to get MPMoviePlayerController working with streaming video feeds...

No luck.

I am using the MoviePlayer sample as the base...
And I have been working with the movieURL function, to change the source video.

I have been successfully at access video outside of the package, on the local hard drive, and on network access drives... but not streaming to an HTTP or an RTSP.

My latest attempt, was altering the line in movieURL (in MyViewController.m) to
NSString *moviePath = @"http://www.itc.virginia.edu/network/videotest/when-lg.mov";

When the app plays, I get an on screen of:
This Movie Could Not Be Played

The Debug/Log reports:
2008-07-17 10:20:12.194 MoviePlayer[4395:20b] ERROR! Please file a bug report!
2008-07-17 10:20:12.195 MoviePlayer[4395:20b] Could not play the movie http://www.itc.virginia.edu/network/videotest/when-lg.mov. We received the AVController_ItemFailedToPlayNotification with info: Error Domain=NSOSStatusErrorDomain Code=-12783 UserInfo=0x1083d20 "This movie could not be played."


Any ideas on how to go getting this to work?

Would you care to share code for what you've got so far? I think streaming video off a local network drive would be quite useful by itself... probably even more useful than internet streaming from HTTP. Especially when combined with the VPN access of the iPhone, where I could access many Gigabytes of my LAN content while traveling :)

jnic
Nov 5, 2008, 06:22 AM
I'm not the original poster, but here's the code I'm using MPMoviePlayer to "stream" (progressive download) movies over HTTP. It's extremely simple:


NSString *url = @"http://www.example.com/path/to/movie.mp4";
MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:url]];
[moviePlayer play];


This often does not work in the simulator, but is always fine on the device. MPMoviePlayer does not appear to support RTSP.

I think streaming video off a local network drive would be quite useful by itself...

For local files, just substitute the remote URL for a local one:

NSString *path = [bundle pathForResource:@"movie" ofType:@"mp4"];
NSString *url = [NSURL fileURLWithPath:path];

jnic
Nov 5, 2008, 06:28 AM
If you're still having problems then it may be due to the video format; MPMoviePlayer is very particular in what it will play.

See Supported Formats in the class reference (http://developer.apple.com/iphone/library/documentation/MediaPlayer/Reference/MPMoviePlayerController_Class/MPMoviePlayerController/MPMoviePlayerController.html) for details.

CommanderData
Nov 5, 2008, 06:39 AM
I'm not the original poster, but here's the code I'm using MPMoviePlayer to "stream" (progressive download) movies over HTTP. It's extremely simple:


NSString *url = @"http://www.example.com/path/to/movie.mp4";
MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:url]];
[moviePlayer play];


This often does not work in the simulator, but is always fine on the device. MPMoviePlayer does not appear to support RTSP.



For local files, just substitute the remote URL for a local one:

NSString *path = [bundle pathForResource:@"movie" ofType:@"mp4"];
NSString *url = [NSURL fileURLWithPath:path];


Hmmm. Am I missing something or are you suggesting local as in locally on the iPhone? What I want to do is use Wifi on the iPhone to access networked hard drives. Let's say I have a 2 Terabyte NAS on my local network that I want to access over Wifi from my iPhone for example (which I currently do from my laptop).

If I take the MoviePlayer sample code, can I just supply it the network location like @"smb://NAS/media/videos/mytestvid.mov" or is it more complex than that?

jnic
Nov 5, 2008, 07:01 AM
are you suggesting local is actually on the iPhone?

Yup, my misunderstanding.

If I take the MoviePlayer sample code, can I just supply it the network location like @"smb://NAS/media/videos/mytestvid.mov" or is it more complex than that?

AFAIK, the movie player doesn't support Samba shares natively. You'd have to start an httpd to serve the videos, and set the URL to be its address on your local network (http://192.168..., etc.), or write your own Samba client to convert it on-the-fly.

nikihana
Feb 6, 2009, 10:13 AM
Hi,

Can you post the code fragment that actually plays a progressive download mp4 strea,?

My app simple crashes when I try it :-(

I am using the MoviePlayer sample as a base...
Thanks,


I was able to access Movies via HTTP progressive download.
I have not returned to accessing a true streaming server, the files I have been able to access where complete video files on the server.

IIRC, I posted this when I was having a problem with the player.
Which ultimately ended up being an incompatibility issue with the DiVX codec/player being installed (The actual one from www.divx.com)

The other Problem I was having at the time, is that I didn't change the URL building to use a URL link instead of a local file.

However, at the end of the work, it did work in the simulator, but not the device. And priorities have shifted, so I haven't returned to getting the streaming video to play.

iGrump
Feb 27, 2009, 06:36 AM
If you're having trouble playing m4v etc from a web URL, make sure that the web server has the correct MIME types set up otherwise you will receive an error when trying to stream within iPhone app.

You can check this by trying to view the movie directly in a web browser - if you get a 404/Page not Found error - this is likely to be MIME types.