PDA

View Full Version : Having trouble playing movie in landscape



BigBMan
03-15-2011, 05:19 AM
I'm calling this in the AppDelegate, but I can't seem to get it to play in Landscape.

-(void) playMovie: (NSString*) theURL {

LogMsg("Launching movie: %s", [theURL cString]);
NSLog(theURL);

NSURL *url = [NSURL fileURLWithPath:theURL];

MPMoviePlayerViewController *playerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:url];

[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(myMovieFinishedCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:[playerViewController moviePlayer]];

[glView addSubview:playerViewController.view];

//---play movie---
MPMoviePlayerController *player = [playerViewController moviePlayer];

SetIsUsingNativeUI(true);

[player play];

GetBaseApp()->OnMovieplayerStart();
}

Any ideas? Tooling around with the orientation settings in Proton code seems to have the GUI and Movie reversed in orientation. Any help would be appreciated.

I'm using iOS 4.2

Seth
03-15-2011, 01:31 PM
Hrm.. good questions. I know that I "hint" to the GUI systems which way to rotate the screen when the keyboard pops up, maybe you need to do something similar before playing the movie, unsure.

I haven't touched the Objective-C side for a while, sort of foggy in my brain... :sweatdrop:

BigBMan
03-16-2011, 01:18 AM
NotifyOSOfOrientationPreference(eOrientationMode(o rientation)); ?
OR
SetIsUsingNativeUI(?);?

Been searching for something but can't find what you're speaking of.

Thanks

BigBMan
03-16-2011, 02:11 AM
NotifyOSOfOrientationPreference(eOrientationMode(o rientation)); ?
OR
SetIsUsingNativeUI(?);?

Been searching for something but can't find what you're speaking of.

I am able to get video to render in landscape if I edit this function accordingly (which previously just returns false):


- (BOOL)shouldAutorotateToInterfaceOrientation:(UIIn terfaceOrientation)myinterfaceOrientation
{
// Return YES for supported orientations.
if (myinterfaceOrientation == UIInterfaceOrientationLandscapeLeft
|| myinterfaceOrientation == UIInterfaceOrientationLandscapeRight) {
return YES;
}

But doing this flips all my other UI to Portrait!

Thanks

Seth
03-16-2011, 04:29 AM
Ok, I was thinking of the NotifyOSOfOrientationPreference command - but looking at it, it doesn't actually do anything.

Hrm.

The way the iOS view works is it says "don't you dare rotate anything, ever" and we internally handle all rotations.

The way we notify proton about orientation changes is by monitoring didRotate. (in MyViewController.mm)

It's there we also give a hint to iOS about which way to orient the keyboard, by doing:
[[UIApplication sharedApplication] setStatusBarOrientation: (UIInterfaceOrientation) interfaceOrientation animated:NO];

The movie player might never work right unless we actually let iOS handle the rotations (return true, like in your test), I'm not sure. (It should always think it's in portrait mode right now...)

The reason I didn't do it this way is I lost about 30% speed if I let iOS rotate my main GL surface. This might no longer be the case though with the latest hardware/software.

So how to cleanly fix this can of worms? Not sure. Maybe have a flag to turn on/off "real rotation" mode for when playing a movie. Maybe force a real iOS rotation to happen when the movie starts. (GetOrientation() should contain the latest one.. but I'm not sure of the Obj-C command to initiate a forced rotation)

BigBMan
03-16-2011, 06:43 AM
Thanks for the reply. I was able to get the movie rendering correctly (albeit hardcoded):


-(void) playMovieWithViewController: (NSString*) theURL
{
LogMsg("Launching movie: %s", [theURL cString]);

MPMoviePlayerViewController *vc = [[MPMoviePlayerViewController alloc]
initWithContentURL:[NSURL fileURLWithPath:theURL]];

MPMoviePlayerController *mp = [vc moviePlayer];

[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(myMovieFinishedCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:mp];

[viewController.view addSubview: vc.view];

[[mp view] setFrame:CGRectMake(0, 0, 1024, 768)];

[viewController presentModalViewController:vc animated:NO];

// Play the movie
[mp play];
}


BUT... I'm not able to return to the EAGLView (getting OpenGL errors):


2011-03-15 23:50:25.352 CDM[179:307] Launching movie: /var/mobile/Applications/CCB0BD3D-C42F-45D9-9BFE-3195E43952FD/CDM.app/S1_Intro.mp4
2011-03-15 23:50:25.506 CDM[179:307] Refusing orientation to interfaceOrientation 4
2011-03-15 23:50:25.508 CDM[179:307] Refusing orientation to interfaceOrientation 4
2011-03-15 23:50:25.509 CDM[179:307] Refusing orientation to interfaceOrientation 4
2011-03-15 23:50:25.511 CDM[179:307] Refusing orientation to interfaceOrientation 1
2011-03-15 23:50:25.512 CDM[179:307] Refusing orientation to interfaceOrientation 3
2011-03-15 23:50:25.514 CDM[179:307] Refusing orientation to interfaceOrientation 4
2011-03-15 23:50:25.515 CDM[179:307] Refusing orientation to interfaceOrientation 2
2011-03-15 23:50:25.521 CDM[179:307] The view controller <MyViewController: 0x234150> returned NO from -shouldAutorotateToInterfaceOrientation: for all interface orientations. It should support at least one orientation.
2011-03-15 23:50:25.526 CDM[179:307] Refusing orientation to interfaceOrientation 4
[Switching to thread 14339]
2011-03-15 23:51:00.146 CDM[179:307] Refusing orientation to interfaceOrientation 4
2011-03-15 23:51:00.149 CDM[179:307] Refusing orientation to interfaceOrientation 4
2011-03-15 23:51:00.150 CDM[179:307] Refusing orientation to interfaceOrientation 4
2011-03-15 23:51:00.156 CDM[179:307] Refusing orientation to interfaceOrientation 1
2011-03-15 23:51:00.158 CDM[179:307] Refusing orientation to interfaceOrientation 3
2011-03-15 23:51:00.160 CDM[179:307] Refusing orientation to interfaceOrientation 4
2011-03-15 23:51:00.161 CDM[179:307] Refusing orientation to interfaceOrientation 2
2011-03-15 23:51:00.170 CDM[179:307] The view controller <MyViewController: 0x234150> returned NO from -shouldAutorotateToInterfaceOrientation: for all interface orientations. It should support at least one orientation.
2011-03-15 23:51:00.180 CDM[179:307] iPad detected
2011-03-15 23:51:01.183 CDM[179:307] failed to make complete framebuffer object 8cd6
2011-03-15 23:51:01.191 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in SetupOrtho line 428
2011-03-15 23:51:01.193 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.198 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.201 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.205 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.208 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.212 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.215 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.219 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.222 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.225 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.229 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Flush line 132
2011-03-15 23:51:01.233 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.237 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Flush line 132
2011-03-15 23:51:01.241 CDM[179:307] DidRotateFromInterface: Got 4, App orientation is 4
2011-03-15 23:51:01.249 CDM[179:307] Refusing orientation to interfaceOrientation 1
2011-03-15 23:51:01.336 CDM[179:307] Finished playing movie
2011-03-15 23:51:01.349 CDM[179:307] ERROR: OpenGL error 0x0502 (1282) in PrepareForGL line 478
2011-03-15 23:51:01.351 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in SetupOrtho line 428
2011-03-15 23:51:01.353 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.354 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.356 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.357 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.362 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.363 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.365 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.367 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.369 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.372 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.378 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Flush line 132
2011-03-15 23:51:01.380 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.382 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Flush line 132
2011-03-15 23:51:01.396 CDM[179:307] ERROR: OpenGL error 0x0502 (1282) in PrepareForGL line 478
2011-03-15 23:51:01.400 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in SetupOrtho line 428
2011-03-15 23:51:01.401 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.404 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.405 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.407 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.411 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.412 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.414 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.415 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.419 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.421 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.423 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Flush line 132
2011-03-15 23:51:01.431 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Blit line 678
2011-03-15 23:51:01.433 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in Flush line 132
2011-03-15 23:51:01.446 CDM[179:307] ERROR: OpenGL error 0x0502 (1282) in PrepareForGL line 478
2011-03-15 23:51:01.450 CDM[179:307] ERROR: OpenGL error 0x0506 (1286) in SetupOrtho line 428

BigBMan
04-05-2011, 05:42 AM
Could really use some more help here :sweatdrop:

Seth
04-07-2011, 07:52 AM
Sorry BigB, got no idea.

I avoid working with the Obj-C end of it so when I need movie playback I'll probably use some codec manually so I can do it crossplatform. Hopefully someone else will chime in at some point before then though.

sundar
03-16-2012, 02:09 PM
Sorry to Bump old thread, Are you Successful in playing the movie (for IOS) ? I am in trying to hook up a cinematic into my game without success. Thanks