iOS: Handheld.PlayFullScreenMovie

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

	Handheld.PlayFullScreenMovie( fileName,, 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.

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 += "";
	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");	
		print ("File NOT FOUND");
	fileName = "file://"+fileName;

	print("Starting fullscreen movie: "+fileName);
	iPhoneUtils.PlayMovieURL( fileName,, iPhoneMovieControlMode.CancelOnTouch);	

Like I say, this is pretty bad code, but hey, I’m new, I was in a very big rush :wink:

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