Results 1 to 9 of 9

Thread: Having trouble playing movie in landscape

  1. #1
    Lesser Wizard
    Join Date
    Nov 2010
    Location
    Los Angeles, California, United States, United States
    Posts
    126

    Default Having trouble playing movie in landscape

    I'm calling this in the AppDelegate, but I can't seem to get it to play in Landscape.
    Code:
    -(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

  2. #2
    Administrator Seth's Avatar
    Join Date
    Jul 2002
    Location
    Japan
    Posts
    5,343

    Default

    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...
    Seth A. Robinson
    Robinson Technologies

  3. #3
    Lesser Wizard
    Join Date
    Nov 2010
    Location
    Los Angeles, California, United States, United States
    Posts
    126

    Default

    NotifyOSOfOrientationPreference(eOrientationMode(o rientation)); ?
    OR
    SetIsUsingNativeUI(?);?

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

    Thanks

  4. #4
    Lesser Wizard
    Join Date
    Nov 2010
    Location
    Los Angeles, California, United States, United States
    Posts
    126

    Default

    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):

    Code:
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)myinterfaceOrientation
    {
             // Return YES for supported orientations.
    	if (myinterfaceOrientation == UIInterfaceOrientationLandscapeLeft
    		|| myinterfaceOrientation == UIInterfaceOrientationLandscapeRight) {
    		return YES;
    }
    But doing this flips all my other UI to Portrait!

    Thanks

  5. #5
    Administrator Seth's Avatar
    Join Date
    Jul 2002
    Location
    Japan
    Posts
    5,343

    Default

    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)
    Seth A. Robinson
    Robinson Technologies

  6. #6
    Lesser Wizard
    Join Date
    Nov 2010
    Location
    Los Angeles, California, United States, United States
    Posts
    126

    Default

    Thanks for the reply. I was able to get the movie rendering correctly (albeit hardcoded):

    Code:
    -(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

  7. #7
    Lesser Wizard
    Join Date
    Nov 2010
    Location
    Los Angeles, California, United States, United States
    Posts
    126

    Default

    Could really use some more help here

  8. #8
    Administrator Seth's Avatar
    Join Date
    Jul 2002
    Location
    Japan
    Posts
    5,343

    Default

    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.
    Seth A. Robinson
    Robinson Technologies

  9. #9

    Default

    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

Similar Threads

  1. Trouble with LNK1104 and dinput8.lib
    By Flav in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 12-30-2009, 11:32 PM
  2. Trouble with CL_InputBox
    By silekey in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 07-11-2007, 08:25 AM
  3. Trouble with CL_SoundBuffer_Session
    By somar in forum Official ClanLib SDK Forums
    Replies: 0
    Last Post: 06-30-2007, 01:30 PM
  4. Trouble
    By FQ101 in forum Funeral Quest
    Replies: 1
    Last Post: 02-09-2007, 05:05 AM
  5. anyone else having trouble getting
    By jimbobbucky in forum Funeral Quest
    Replies: 4
    Last Post: 07-16-2003, 04:41 AM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •