x


Stop sliding transition animation when playing a movie with iOS

When I play a movie using:

iPhoneUtils.PlayMovie("MyMovie.m4v", transitionColour, iPhoneMovieControlMode.CancelOnTouch, iPhoneMovieScalingMode.AspectFill);

The iPhone slides the movie in to view before playing, the problem is I need to play the movie in position as I'm trying to create a seamless effect where the movie plays on top of the game view.

I've done some research and from what I can tell Unity is calling

[moviePlayer setFullscreen:YES animated:YES]

where the animated line needs to say no... unfortunately I don't know where I can change this. If anyone knows how and could provide a quick step by step instruction it would be great.

Thanks!

more ▼

asked Jul 28 '11 at 12:05 PM

AbelDrew gravatar image

AbelDrew
31 1 1 1

I'm having the same issue, i will keep you posted.

Jul 28 '11 at 09:54 PM funksville

thanks, I've sent the question to unity support as well hopefully they'll answer. I'll post back if they do.

Jul 29 '11 at 08:35 AM AbelDrew

Quoted from an e-mail I got from http://support.unity3d.com

"Ok, At the moment this hasn't been changed/exposed from the Apple default movieTexture player. i.e. [moviePlayer setFullscreen:YES animated:YES] isn't actually called any where. It might be possible for you to set non-animated via a custom plugin... Otherwise atm there is nothing out of the box to enable/disable this..."

So this doesn't look hopeful. :/

Maybe someone out there knows how to get this working.

Aug 01 '11 at 02:31 PM AbelDrew
(comments are locked)
10|3000 characters needed characters left

5 answers: sort voted first

Unity 4.0.1f2 and this is still a problem. Why isn't the animation option exposed in Unity's iPhoneUtils function? I'd like to try coquifrogs' solution, but I don't really know where to put that code, or which parts of JRSwizzle to put where. Has anything changed in the last two years since this problem was first identified?

more ▼

answered Jan 30 at 06:05 PM

Tim_c22 gravatar image

Tim_c22
16

(comments are locked)
10|3000 characters needed characters left

I've managed to fix this in a hackish way. Swapping the implementation of [UIViewController presentMoviePlayerViewControllerAnimated] with a version that presents the movie player controller modally with no animation. No guarantees this works for your situation, but it works for us:

#import "JRSwizzle.h"
#import <MediaPlayer/MediaPlayer.h>

@interface UIViewController(OverrideAnimatedTransition)
- (void) nonanimatedPresentMoviePlayerViewControllerAnimated:(MPMoviePlayerViewController*) moviePlayerViewController;
- (void) nonanimatedDismissMoviePlayerViewControllerAnimated;
@end

@implementation UIViewController(OverrideAnimatedTransition)
- (void) nonanimatedPresentMoviePlayerViewControllerAnimated:(MPMoviePlayerViewController*) moviePlayerViewController {
    [self presentModalViewController:moviePlayerViewController animated:NO];
}

- (void) nonanimatedDismissMoviePlayerViewControllerAnimated {
    [self dismissModalViewControllerAnimated:NO];
}
@end

I use the JRSwizzle code from https://github.com/rentzsch/jrswizzle to do the method implementation swaps in the appDidFinishLanuching like so:

NSError* err = nil;

[UIViewController jr_swizzleMethod:@selector(presentMoviePlayerViewControllerAnimated:) withMethod:@selector(nonanimatedPresentMoviePlayerViewControllerAnimated:) error:&err];
    [UIViewController jr_swizzleMethod:@selector(dismissMoviePlayerViewControllerAnimated) withMethod:@selector(nonanimatedDismissMoviePlayerViewControllerAnimated) error:&err];
more ▼

answered Jun 04 '12 at 07:54 PM

coquifrogs gravatar image

coquifrogs
1 1 1 1

I basically have the same problem as Tim_c22. Any help on how to fix this or how to implement the fix provided by coquifrogs would be very helpful. Thanks!

Jan 31 at 03:23 PM btree

This worked for me as recent as Apr 2013. Important to note that importing #import rather than the other comment below that imports "VideoViewController.h" worked for us.

Thanks!

Apr 01 at 03:31 PM vak151
(comments are locked)
10|3000 characters needed characters left

Any solution? I encountered that in Unity 3.3 this bug was not there, but Unity 3.4 will have this bug.

How could I play it with my own code? I know how to play a video with objective-C but I dont know how to find out the location of the Streaming folder of unity.

more ▼

answered Aug 11 '11 at 08:46 PM

sendel76 gravatar image

sendel76
6 2 2 4

Any workaround greatly appreciated!!!!!

Mar 26 '12 at 04:08 PM peter
(comments are locked)
10|3000 characters needed characters left

We managed to implement the solution provided by coquifrogs.

Get JRSwizzle.h and JRSwizzle.m from https://github.com/rentzsch/jrswizzle. Place them in your Classes folder inside your Xcode project.

Generate a file called UIViewController.h and place it in the Classes folder as well. Put the following code in UIViewController.h

#import "JRSwizzle.h"
#import "VideoViewController.h"
@interface UIViewController(OverrideAnimatedTransition)
- (void) nonanimatedPresentMoviePlayerViewControllerAnimated:(MPMoviePlayerViewController*) moviePlayerViewController;
- (void) nonanimatedDismissMoviePlayerViewControllerAnimated;
@end
@implementation UIViewController(OverrideAnimatedTransition)
- (void) nonanimatedPresentMoviePlayerViewControllerAnimated:(MPMoviePlayerViewController*) moviePlayerViewController {
    [self presentModalViewController:moviePlayerViewController animated:NO];
}
- (void) nonanimatedDismissMoviePlayerViewControllerAnimated {
    [self dismissModalViewControllerAnimated:NO];
}
@end

Locate the class AppController.mm and put the following code at didFinishLaunchingWithOptions():

NSError* err = nil;

[UIViewController jr_swizzleMethod:@selector(presentMoviePlayerViewControllerAnimated:) withMethod:@selector(nonanimatedPresentMoviePlayerViewControllerAnimated:) error:&err];
    [UIViewController jr_swizzleMethod:@selector(dismissMoviePlayerViewControllerAnimated) withMethod:@selector(nonanimatedDismissMoviePlayerViewControllerAnimated) error:&err];


You may need to import

#import "JRSwizzle.h"
#import "UIViewController.h"

in AppController.mm


After that the video played without the scrolling transition. Thanks coquifrogs!

more ▼

answered Feb 07 at 10:56 AM

btree gravatar image

btree
1 1

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1953
x57
x41
x15
x2

asked: Jul 28 '11 at 12:05 PM

Seen: 1918 times

Last Updated: Apr 01 at 03:31 PM