0
我照顧了與alloc對象有關的內存泄漏,但是我認爲我的代碼被堵塞了,因爲現在我的視頻剪輯無法播放。我相信我已經在剪輯開始之前讓設備釋放。有人可以幫我重新安排我的代碼嗎?我會非常感激一些提示讓播放重新工作。這是我正在使用的一個樣本。視頻剪輯不再播放(autorelease問題)
@implementation ELECTRIC_GROOVEYViewController
-(IBAction)playMovie:(id)sender
{
NSString *filepath = [[NSBundle mainBundle] pathForResource:@"1960" ofType:@"m4v"];
NSURL *fileURL = [NSURL fileURLWithPath:filepath];
MPMoviePlayerController *moviePlayerController =
[[[MPMoviePlayerController alloc] initWithContentURL:fileURL]autorelease];
[self.view addSubview:moviePlayerController.view];
moviePlayerController.fullscreen = YES;
moviePlayerController.scalingMode = MPMovieScalingModeAspectFill;
[[NSNotificationCenter defaultCenter] removeObserver:self
name:MPMoviePlayerLoadStateDidChangeNotification
object:nil];
// no moviecontrolls
moviePlayerController.controlStyle = MPMovieControlStyleNone;
// looping forever
moviePlayerController.repeatMode= MPMovieRepeatModeOne;
[moviePlayerController play];
}
謝謝您的回覆Deepak。但是,當我輸入我的實例變量的代碼時,我收到錯誤。儘管製作實例引用,但我的視頻剪輯仍然無法播放,所以構建完成。你能說明我上面的代碼可能做錯了嗎?我非常感謝你的幫助。 – 2011-05-24 18:52:07
@Jay,對不起,之前沒有注意到這一點,你是否已經解決了這個問題? – 2011-05-28 03:21:45