0

为什么在底部进程中获得第二个数字是 0.00000

 NSURL    *movieURL = [NSURL URLWithString:@"s26a.mov"];

NSDictionary *opts = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO]
                                                                   forKey:AVURLAssetPreferPreciseDurationAndTimingKey];                    
 AVURLAsset *urlAsset = [AVURLAsset URLAssetWithURL:movieURL options:opts]; 
 float minute = 0;
 float second = 0; 
 second = urlAsset.duration.value / urlAsset.duration.timescale; 
 NSLog(@"movie duration : %f", second);                    
4

1 回答 1

1

您可以像这样获得电影时长:

 Float64 durationSeconds = CMTimeGetSeconds([urlAsset duration]); // any AVURLAsset 
于 2012-08-17T04:29:49.043 回答