tags:

views:

1428

answers:

3

Hi,

I would like to write an app that downloads (or streams) a video (encoded as required) in a view. I dont want to use the MPVideoPlayer from the SDK as it opens the video in full screen. I would like to place another UIView (transparent) over the video so that my users can annotate over the video.

Anyone have any idea or can point me to some code that will play video in a UIView?

+1  A: 

If you want to do this you will need to include your own (software) video decoder, which will not have access to the hardware acceleration on the system. Even if you can get it working with acceptable performance it will be a huge battery drain.

Louis Gerbarg
There are quite a few video player apps (UStream, Qik, etc) who do play video on the iPhone
teedee1198
Yes, and they do what I just described, they include their own software decoder in the app and have much worse battery life than the builtin video playback at equal framerates and resolutions.
Louis Gerbarg
Why does Apple not provide better video support, then? That' stupid. Video is the future.
HelloMoon
Because even when you know what the future is you often have to deal with the present realities. I would imagine video hardware on the device is limited and the hardware h.264 is physically incapable of decompressing onto an aribitrary surface and needs to hit the entire backbuffer, modulo some compositing for controls. If they had a choice between no hardware support or hardware that can not play into arbitrary surfaces then choosing to use the hw and requiring full screen is the right choice.
Louis Gerbarg
A: 

Maybe you should check the MediaPlayer's private headers, and simply add the video's view as your view's subview.

Mike Chen
Then, Apple would just trash your app.
HelloMoon
Unless otherwise stated, it's probably reasonable to assume that OP is hoping to create a "legal" app for eventual distribution. Private headers preclude that.Question-askers: if solutions involving Jailbreak or potential disallow from the app store are acceptable, please say so in the question.
Olie
+1  A: 

If you wish to play a video in portrait mode, I have solution for that.

If you think that -MPMovie Player can run under a view, according to me it's not possible.

MP Movie player will work as Apple has designed.

So, MP Movie player will always / almost run in full screen.

Solution for portrait mode.

@interface MPMoviePlayerController (extend)
-(void)setOrientation:(int)orientation animated:(BOOL)value;
@end

moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:movieUR];
[moviePlayer setOrientation:UIDeviceOrientationPortrait animated:NO];
if (moviePlayer)
{
        [self.moviePlayer play];
}

Hope that will help to you.

See, My question is very similar like yours.

http://stackoverflow.com/questions/1422930/playing-video-in-custom-size-screen-view-in-iphone

sugar