Re: MPMoviePlayerController
Re: MPMoviePlayerController
- Subject: Re: MPMoviePlayerController
- From: Jeffrey Walton <email@hidden>
- Date: Sat, 16 Apr 2011 13:19:22 -0400
On Sat, Apr 16, 2011 at 12:39 PM, Matt Neuburg <email@hidden> wrote:
>
> On Apr 16, 2011, at 9:00 AM, Jeffrey Walton wrote:
>
>>
>> For what its worth, Apple's sample [1] is broken - it can't even play
>> the movie it supplies with its sample.
>>
>> Jeff
>>
>> [1] http://developer.apple.com/library/ios/#samplecode/MoviePlayer_iPhone/Introduction/Intro.html
>
> That's a well-known bug in the example. It has nothing to do with the movie. In fact, I used that same movie in the tests for my book (you can see in the screen shots in the discussion of MPMoviePlayerController).
Out of curiosity, did you test your book's code against a movie
acquired from iTunes? In my naiveness, I thought the combination of an
iTunes movie on authorized Apple hardware would work out of the box.
(I have not ruled out DRM at this point).
> The history appears to be that this was a Mac OS X example and was then made available for iOS, and the example has forgotten to compensate. The code says [self.moviePlayer play], but they've forgotten the most important step: add the MPMoviePlayerController's view to the interface. So in fact the movie *is* playing - you just can't see it because it isn't in the interface. (On Mac OS X I think the movie played in a different window, but of course there is no "different window" on iOS.)
>
> It's easy to fix:
>
> -(IBAction)playMovieButtonPressed:(id)sender
> {
> MoviePlayerAppDelegate *appDelegate =
> (MoviePlayerAppDelegate *)[[UIApplication sharedApplication] delegate];
> [appDelegate initAndPlayMovie:[self localMovieURL]];
> UIView* v = [appDelegate moviePlayer].view;
> appDelegate.moviePlayer.scalingMode = MPMovieScalingModeAspectFit;
> v.frame = CGRectMake(54,39,205,135);
> [[sender superview] addSubview:v];
> return;
> }
This looks similar to other examples I've seen. There is a noted
difference - the player appears to be part of the Application's
delegate rather than a modally presented view.
> You could easily have found this out with Google; explanations of how to fix this example are plastered all over the Internet.
Perhaps my expectations are too high - I expect examples from the
vendor should work, without the need for an easter egg hunt. I think
its a reasonable expectation.
> PS. And of course, the chapter in my book about MPMoviePlayerController lays a lot of stress on your responsibility to put the darned view into the interface! :)
OK. I look forward to the day it goes to press (I've got it preordered
via Amazon).
Jeff
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden