I've been looking around for the solution to my problem and nothing I seem to try works! I have 6 buttons that play 6 different video files. If I press one, it plays fine. If I press done and go back and press another button, it plays fine. But once I hit done on the second video, the app crashes and I get a "EXE_BAD_ACCESS" error. I know it has something to do with memory leaks and all that. I've tried releasing the String for the video URL, I've tried draining the pool and such. No Luck. Below is code. If you can share some insight or if you have run into this problem before and know what the hells going on I'd appreciate a response! Thank you!
im assuming that the problem is that your video files are huge sizes... remember that the iphone screen is 3 inches by 2 inches. make your video sizes way smaller thus decresing the file sizes but keeping the same quality if not better when resizing to an iphone screen
GOOD LUCK!
OK, first of all, do you know about arrays or variables or anything to avoid having to write the exact same code six times like that? It hurts my head.
You don't need the releasepools at all - you are using all foundation class convenience methods so you don't have to worry about releasing anything.
You've got a bug in videothree - the variable you construct is videoThreecallmoviePath but you return something else - that shouldn't even compile, but maybe it just gives a warning. If it does, that probably would cause a crash.
I would try running with NSZombiesEnabled = YES to see if you're trying to access a prematurely released object. Oh and figure out how to abstract things so you don't need six separate copies of every method... that's just crazy.
orange gold - Is there like an ideal limit to the filesize for playing a local video? I converted the video files using itunes for ipod and iphone(they are 320x480).
jsd - i'll try using NSZombiesEnabled...and I know that I should use an array, i'm kind of just learning it all so just wanted to see if I could get the idea to work but thanks for the heads up.
Hello, I'm just starting out building iPhone apps. I, too, needed to play more than one video in my project. I tried creating a seperate class to load movies when I needed them, but it's not working perfectly, and in the interest of time I found your code and used that. Nice and streamlined. I see what you mean by the crashing after 2 plays. It happens to me too. I fixed it though. when you set up the notification part (which i still don't quite understand, but in time), you have this:
.....name:MPMoviePlayerPlaybackDidFinishNotificati on object:nil];
you have to set nil to the object you're checking. in your case it's
......object:moviePlayerObject];
I did that and now my videos play as many times as I click on them and hit done. Hope it works for you if you haven't already figured it out.