Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 播放两部电影';同步地_Objective C_Cocoa_Qtkit - Fatal编程技术网

Objective c 播放两部电影';同步地

Objective c 播放两部电影';同步地,objective-c,cocoa,qtkit,Objective C,Cocoa,Qtkit,我有一个Cocoa应用程序,它应该完全同步地播放两个不同的QTMovie对象。两部电影的分辨率、大小等都相同,但长度可能不同。电影是压缩的,必须是多线程的 我目前的建议是: NSMutableDictionary *movieAttributes1 = [NSMutableDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:NO], Q

我有一个Cocoa应用程序,它应该完全同步地播放两个不同的QTMovie对象。两部电影的分辨率、大小等都相同,但长度可能不同。电影是压缩的,必须是多线程的

我目前的建议是:

NSMutableDictionary *movieAttributes1 = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                         [NSNumber numberWithBool:NO], QTMovieOpenAsyncOKAttribute,
                                         [NSNumber numberWithBool:YES], QTMovieOpenForPlaybackAttribute,
                                         nil];

[movieAttributes1 setValue:pathOfFile1 forKey:QTMovieFileNameAttribute];

NSMutableDictionary *movieAttributes2 = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                         [NSNumber numberWithBool:NO], QTMovieOpenAsyncOKAttribute,
                                         [NSNumber numberWithBool:YES], QTMovieOpenForPlaybackAttribute,
                                         nil];

[movieAttributes2 setValue:pathOfFile2 forKey:QTMovieFileNameAttribute];


QTMovie* leftMovie = [QTMovie movieWithAttributes:movieAttributes1 error:nil];
QTMovie* rightMovie = [QTMovie movieWithAttributes:movieAttributes2 error:nil];

....

[leftMovie play];
[rightMovie play];
在播放按钮ClickHandler中完成

在10个案例中,有9个是这样的,但有时电影是异步播放的。我还确信,在高cpu负载的情况下,它们将变得异步


有什么想法吗?非常感谢。

我不相信API中有任何受支持的方法可以做到这一点。您可能需要定期同步它们


为此,设置一个计时器,将第二部电影的精确时间设置为每秒钟或半秒钟第一部电影的精确时间。如果其中一个超过了另一个的最大持续时间,请停止计时器并让它正常运行。

谢谢,我尝试了类似于[leftMovie setCurrentTime:[rightMovie currentTime]]的方法;但情况会变得更糟。我相信我必须更仔细地了解QuickTime API,而不是QTKit。