• 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
2
Question by scottyboydee · Mar 16, 2012 at 12:00 AM · iosiphoneipadmovie

iOS: Handheld.PlayFullScreenMovie

I seem to be unable to play movies using this line:

     Handheld.PlayFullScreenMovie( fileName, Color.black, FullScreenMovieControlMode.Hidden, FullScreenMovieScalingMode.Fill);    


  • the filename is right (as verified by a call to System.IO.File.Exists( fileName ) - which fails if I give bad filenames) and I've tried movies shot on the iPhone, movies from Apple's owan site, labelled as transcoded for iPod, etc, so I'm sure the format is right.

However, I continually get a crash on:

playmovie(4953,0x1e03000) malloc: error for object 0x1c849b8: pointer being freed was not allocated set a breakpoint in malloc_error_break to debug

If I give it a bad filename, the movieplayer starts then closes again (without crashing). As far as I can tell, I'm giving it a good filename and file.

I'm testing on devices running iOS 5.1

Any suggestions? Does anybody have a working movie file / demo project I could see with this all working? I'm amazed a one-liner that should Just Work is proving so problematic.

Comment
Add comment · Show 1
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 cregox · Jul 10, 2012 at 02:37 PM 0
Share

$$anonymous$$aybe you should file a bug report.

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by scottyboydee · Apr 13, 2012 at 08:56 AM

I sort of solved this...

In the end, I realised that I was using the developer preview of Unity 3.5, and went back to Unity 3.43 (at the time, the most recent fully-stable build).

This did mean that I had to recreate my scene entirely (lost about half a day to doing that) but the calls worked and I got my product made on time in the end.

Here's my code - the bit that finds the path is very hacky, I suspect you don't need all that (there are other articles on this subject), but all I can say is that it worked, so perhaps it could form part of a solution for you.

I also used iExplorer to go on my device, into the directory of my app and check for absolutely certain that the movie file had been copied into the directory on the device (though while I deploy, you could usually see the status in Xcode change when it was copying the bigger resources, so I was pretty sure).

 string getStreamingPath()
 {
     string path = Application.persistentDataPath;
     
     string docName = "Documents";
     
     string newPath = path.Substring( 0, path.Length - docName.Length );
     
     newPath += "TestMovie.app/Data/Raw/";
     
     return newPath;
     
 }

 public void play( string movieName ) 
 {
     print ("Starting!");
     
     string path = getStreamingPath();
     
     string fileName = path + movieName;
             
     if( System.IO.File.Exists( fileName ) )
     {
         print ("File EXISTS");    
     }
     else
     {
         print ("File NOT FOUND");
     }
     
     fileName = "file://"+fileName;
 
     print("Starting fullscreen movie: "+fileName);
     iPhoneUtils.PlayMovieURL( fileName, Color.black, iPhoneMovieControlMode.CancelOnTouch);    
 }

Like I say, this is pretty bad code, but hey, I'm new, I was in a very big rush ;)

Hope some of that might be useful to you, I didn't find anything (on three different forums) that worked for me beside going back a version 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 cregox · Jul 10, 2012 at 02:37 PM 0
Share

$$anonymous$$aybe going forward? I had no such issues before 3.5, in 3.5.0b6 or 3.5.2f2, both for iPhone and Android.

avatar image
1

Answer by Haxx0rz · Jul 24, 2012 at 09:41 PM

I had the same problem, where the player in the iPad closes on its own, but I was able to fix it. The reason, I had an incompatible file type (.ogv). Here

Unity iOS supports any movie file types that play correctly on an iOS device, implying files with the extensions .mov, .mp4, .mpv, and .3gp and using one of the following compression standards:

H.264 Baseline Profile Level 3.0 video

- MPEG-4 Part 2 video [Source here][1] I used iPhoneUtils.PlayMovieURL by the way. It still seems to work (using Unity iPhone Pro 3.5.0f5) even though it does not appear in the autocomplete or marked as [Obsolete] when I type it in MonoDevelop. Took me a while to fix this one as well, but I hope it helped out. [1]: http://docs.unity3d.com/Documentation/Manual/VideoFiles.html
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

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

7 People are following this question.

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

Related Questions

Unity modules for iOS? 1 Answer

iPhone Controller Asset 0 Answers

Setting resolutions for iPad and iPhone 0 Answers

How to identify each iOS device? 1 Answer

Xcode build crashes 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