QTMovie 委托方法未被调用
嘿,我试图捕获 QTMovie 进度委托方法调用,但委托方法似乎没有被调用。我试图通过实现
- (BOOL)movie:(QTMovie *)movie ShouldContinueOperation:(NSString *)op withPhase:(QTMovieOperationPhase)phase atPercent:(NSNumber *)percent withAttributes:(NSDictionary 来捕获转换进度事件*)属性
但该方法没有被调用。我在这里查看了苹果示例代码 http://developer.apple.com/library/mac/#samplecode/QTKitProgressTester/Introduction/Intro.html#//apple_ref/doc/uid/DTS10003631并且似乎看不到我的代码和他们的代码之间有很大差异。该文件被很好地转换并显示在我的桌面上,我可以毫无问题地播放它。我只是无法获取进度事件。有什么想法吗?这是我用来测试这个的演示应用程序。
#import "testProjAppDelegate.h"
#import <QTKit/QTKit.h>
@implementation testProjAppDelegate
@synthesize window;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
QTMovie* movie = [QTMovie movieWithFile:@"/Users/Morgan/Desktop/sample_iTunes.mov" error:nil];
if (movie)
{
[movie setDelegate:self];
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], QTMovieExport,
[NSNumber numberWithInt:kQTFileType3GPP], QTMovieExportType, nil];
[movie writeToFile:@"/Users/Morgan/Desktop/test.mp4" withAttributes:dict error:nil];
NSLog(@"DONE");
}
}
- (BOOL)movie:(QTMovie *)movie shouldContinueOperation:(NSString *)op withPhase:(QTMovieOperationPhase)phase atPercent:(NSNumber *)percent withAttributes:(NSDictionary *)attributes
{
NSLog(@"PROGRESS");
return YES;
}
@end
Hey, I'm trying to trap the QTMovie progress delegate method calls, and the delegate methods don't seem to be getting called. I'm trying to trap the conversion progress event by implementing
- (BOOL)movie:(QTMovie *)movie shouldContinueOperation:(NSString *)op withPhase:(QTMovieOperationPhase)phase atPercent:(NSNumber *)percent withAttributes:(NSDictionary *)attributes
but the method is not getting called. I've looked at apples sample code here http://developer.apple.com/library/mac/#samplecode/QTKitProgressTester/Introduction/Intro.html#//apple_ref/doc/uid/DTS10003631 and can't seem to see very much difference between my code and their code. The file gets converted fine and shows up on my desktop and I can play it without issues. I just can't get the progress events. Any ideas? Here is my demo app that I'm using to test this with.
#import "testProjAppDelegate.h"
#import <QTKit/QTKit.h>
@implementation testProjAppDelegate
@synthesize window;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
QTMovie* movie = [QTMovie movieWithFile:@"/Users/Morgan/Desktop/sample_iTunes.mov" error:nil];
if (movie)
{
[movie setDelegate:self];
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], QTMovieExport,
[NSNumber numberWithInt:kQTFileType3GPP], QTMovieExportType, nil];
[movie writeToFile:@"/Users/Morgan/Desktop/test.mp4" withAttributes:dict error:nil];
NSLog(@"DONE");
}
}
- (BOOL)movie:(QTMovie *)movie shouldContinueOperation:(NSString *)op withPhase:(QTMovieOperationPhase)phase atPercent:(NSNumber *)percent withAttributes:(NSDictionary *)attributes
{
NSLog(@"PROGRESS");
return YES;
}
@end
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这似乎不起作用,因为我的应用程序是为 64 位编译的。我假设这是 QTKit 框架中的一个错误?我发现其他一些提到 QTMovie 代表无法在 64 位应用程序中工作的内容。我可以编译 32 位应用程序,但这不是问题。不过,这应该可以在 64 位上运行,不是吗?
It appears that this is not working because my app was compiled for 64 bit. I'm assuming this is a bug in the QTKit framework? I found a few other mentions of QTMovie delegates not working in 64 bit applications. I can compile my app for 32 bit though which isn't a problem. Still, this should work in 64 bit, shouldn't it?