• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
3
Question by AbelDrew · Jul 28, 2011 at 12:05 PM · iostransitionslidingiphoneutils

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!

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image funksville · Jul 28, 2011 at 09:54 PM 0
Share

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

avatar image AbelDrew · Jul 29, 2011 at 08:35 AM 0
Share

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

avatar image AbelDrew · Aug 01, 2011 at 02:31 PM 0
Share

Quoted from an e-mail I got from 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. :/

$$anonymous$$aybe someone out there knows how to get this working.

4 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by coquifrogs · Jun 04, 2012 at 07:54 PM

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];
Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image btree · Jan 31, 2013 at 03:23 PM 0
Share

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!

avatar image vak151 · Apr 01, 2013 at 03:31 PM 0
Share

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!

avatar image
1

Answer by Tim_c22 · Jan 30, 2013 at 06:05 PM

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?

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by btree · Feb 07, 2013 at 10:56 AM

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!

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image nicloay · Jan 23, 2015 at 01:29 PM 0
Share

what you can do is 1 - place JRSwizzle.h, JRSwizzle.m, UIViewController.h to the Assets/Plugins/iOS folder 2 - Create UnityAppController.m int the same folder Assets/Plugins/iOS with following content

 #import <UnityAppController.h>
 #import "JRSwizzle.h"
 #import "UIViewController.h"
 
 
 @implementation UnityAppController(SwizzlePlayer)
 
 + (void)load {
     NSError* err = nil;        
     [UIViewController jr_swizzle$$anonymous$$ethod:@selector(present$$anonymous$$oviePlayerViewControllerAnimated:) with$$anonymous$$ethod:@selector(nonanimatedPresent$$anonymous$$oviePlayerViewControllerAnimated:) error:&err];
     [UIViewController jr_swizzle$$anonymous$$ethod:@selector(dismiss$$anonymous$$oviePlayerViewControllerAnimated) with$$anonymous$$ethod:@selector(nonanimatedDismiss$$anonymous$$oviePlayerViewControllerAnimated) error:&err];
 }    
 @end

So when you build your game, you don't need to do anything else

avatar image
0

Answer by sendel76 · Aug 11, 2011 at 08:46 PM

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.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image peter · Mar 26, 2012 at 04:08 PM 0
Share

Any workaround greatly appreciated!!!!!

Your answer

Hint: You can notify a user about this post by typing @username

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

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

10 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Occasional black screen and lock up when using Handheld.PlayFullScreenMovie 1 Answer

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Sliding between camera change 1 Answer

Issue with iPhoneUtils.PlayMovie 1 Answer

iPhoneUtils when application enters background issue! 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges