IOS 6 - Auto Rotate MPMovieplayer - ios6

So, i'm fix interface Iphone is portrait and i wanna show landscapte when i playing video(using MPMoviePlayerController), i have read in ios6 sdk,ShouldAutorotateToInterfaceOrientation is deprecated. How to rotate only this player view? I can only rotate whole app, but don't want to do this.
i tryed with
(BOOL)shouldAutorotate
{
return [[self.viewControllers lastObject] shouldAutorotate];
}
-(NSUInteger)supportedInterfaceOrientations
{
return [[self.viewControllers lastObject] supportedInterfaceOrientations];
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return [[self.viewControllers lastObject] preferredInterfaceOrientationForPresentation];
}
in this link or link but video still doesn't change.. Can you help me

First of all, in your app settings, do you allow any other orientation besides portrait?
Second, is your view controller embedded in an UINavigationController/UITabBarController/UISplitViewController?
The code you posted is supposed to work as a category or by subclassing an UINavigationController. If your container is not a UINavigationController, it won't work.(at least not for UITabBarController).
Can you also post the code where you enable to rotation for your view controller?
Also, it could be helpful to also show the whole code for your category/subclass.

Related

From iOS Objective-C code and Android Java code to a Codename One PeerComponent

At the page https://www.wowza.com/docs/how-to-build-a-basic-app-with-gocoder-sdk-for-ios there are the following examples:
if (self.goCoder != nil) {
// Associate the U/I view with the SDK camera preview
self.goCoder.cameraView = self.view;
// Start the camera preview
[self.goCoder.cameraPreview startPreview];
}
// Start streaming
[self.goCoder startStreaming:self];
// Stop the broadcast that is currently running
[self.goCoder endStreaming:self];
The equivalent Java code for Android is reported at the page https://www.wowza.com/docs/how-to-build-a-basic-app-with-gocoder-sdk-for-android#start-the-camera-preview, it is:
// Associate the WOWZCameraView defined in the U/I layout with the corresponding class member
goCoderCameraView = (WOWZCameraView) findViewById(R.id.camera_preview);
// Start the camera preview display
if (mPermissionsGranted && goCoderCameraView != null) {
if (goCoderCameraView.isPreviewPaused())
goCoderCameraView.onResume();
else
goCoderCameraView.startPreview();
}
// Start streaming
goCoderBroadcaster.startBroadcast(goCoderBroadcastConfig, this);
// Stop the broadcast that is currently running
goCoderBroadcaster.endBroadcast(this);
The code is self-explaining: the first blocks start a camera preview, the second blocks start a streaming and the third blocks stop it. I want the preview and the streaming inside a Codename One PeerComponent, but I didn't remember / understand how I have to modify both these native code examples to return a PeerComponent to the native interface.
(I tried to read again the developer guide but I'm a bit confused on this point).
Thank you
This is the key line in the iOS instructions:
self.goCoder.cameraView = self.view;
Here you define the view that you need to return to the peer and that we can place. You need to change it from self.view to a view object you create. I think you can just allocate a UIView and assign/return that.
For the Android code instead of using the XML code they use there you can use the WOWZCameraView directly and return that as far as I can tell.

Display video in landscape mode only on Full screen using MPMoviePlayerController in ios6

I want to display the video in landscape mode only when video is playing in fullscreen using MPMoviePlayerController in ios6. My application supports only portrait mode.
Can anybody please suggest me, how can i do this?
Thanks.
I got the answer from below link
iOS 6 MPMoviePlayerViewController and presentMoviePlayerViewControllerAnimated Rotation
Make changes in application delegate file as fllows and its working:
Only change the UIview name as MPSwipableView in ios6
- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
if ([[self.window.subviews.lastObject class].description isEqualToString:#"MPSwipableView"]) {
return UIInterfaceOrientationMaskAllButUpsideDown;
}
else {
return UIInterfaceOrientationMaskPortrait;
}
}
In your viewController, implement this method,
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape
}

Does Everyplay support Landscape in iOS6?

I'm integrating Everyplay with my Cocos2d Game.My game only support Landscape orientation.
Everything goes well on iPad.
But When i test on iPhone(iOS6),it throws exception as following when I call "[[Everyplay sharedInstance] showEveryplay]":
reason: 'Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES'
I know orientation mechanism changed in iOS6.So i add this method:
-(BOOL)shouldAutorotate{
return YES;
}
-(NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscape;
}
-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
return UIInterfaceOrientationMaskAllButUpsideDown;
}
Then "[[Everyplay sharedInstance] showEveryplay]" works without exception, but my game also support Portrait orientation that I do not want to.
How can I do if I only want to support Landscape in My Game, but let "[[Everyplay sharedInstance] showEveryplay]" works without exception?
You have two options how to fix the problem.
Option 1:
Add UISupportedInterfaceOrientations array into your game's info.plist with items UIInterfaceOrientationPortrait, UIInterfaceOrientationLandscapeLeft, UIInterfaceOrientationLandscapeRight and UIInterfaceOrientationPortraitUpsideDown. You can easily do this from xCode by checking all Supported Interface Orientations from your project summary page or by editing the info.plist file manually.
Option 2:
Add the following method to your application's AppDelegate.m file:
// IOS 6
-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
return UIInterfaceOrientationMaskAll;
}
In both cases you must also make sure that you have added the landscape only orientation handling code to your game's main UIViewController.
// IOS 5
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
return UIInterfaceOrientationIsLandscape(toInterfaceOrientation);
}
// IOS 6
- (BOOL)shouldAutorotate {
return YES;
}
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight;
}
On iPhone Everyplay webview is always on portrait mode, but on iPad the webview supports both. Recording supports both modes as does the video player. We will likely in near future update the landscape mode for iPhone resolution too, but it will require some redesign before this task is complete.

UIInterfaceOrientation in Landscape only in one controller otherwise only Portrait has to be supported

I have to write an universal app, the iPhone part has only to be presented in Portrait so it would be the preferred orientation and it doesn't have to support other orientations, BUT I encountered the problem that adding a MPMoviePlayerController inside a modally presented controller it's ability have to rotate in Landscape.
For this if I block only in portrait the supported interface orientations in the app settings and in that controller I do:
- (BOOL) shouldAutorotate
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskLandscapeRight;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeLeft;
}
the result is a 'preferredInterfaceOrientationForPresentation must return a supported interface orientation!' crash.
Otherwise if I have to set supported orientations Portrait and Landscape but everywhere block the preferred orientation and set shouldrotate to NO in every controller should work I suppose but it would be really a bad thing in my opinion.
How you will do with this kind of new interface orientation mechanism?
Thanks

How to disable autorotation for iPhone application?

I am implementing an Universal application. In my application I need to Autorotate the screen for the iPad only not for the iPhone. How can I do that? I tried with the following code but it is not working.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return NO;
}
Finally I made it by making changes to the properties in plist file.
After struggling to set in UIViewController's shouldAutorotate and supportedInterfaceOrientation methods, with no success in iOS6, I found the most effective is to set it in app delegate.
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
return UIInterfaceOrientationMaskPortrait;
}
However returning UIInterfaceOrientationMaskPortraitUpsideDown was crashing my app. I don't know what I was doing wrong!

Resources