这可能看起来很荒谬,但是我如何在Objective-C中将CMTime的秒数输出到控制台?我只需要值除以时间刻度,然后以某种方式在控制台中看到它。
发布于 2012-02-19 07:31:41
NSLog(@"seconds = %f", CMTimeGetSeconds(cmTime));发布于 2012-02-19 07:30:13
简单:
NSLog(@"%lld", time.value/time.timescale);发布于 2015-07-21 14:34:57
如果你想转换成hh:mm:ss格式,你可以使用这个
NSUInteger durationSeconds = (long)CMTimeGetSeconds(audioDuration);
NSUInteger hours = floor(dTotalSeconds / 3600);
NSUInteger minutes = floor(durationSeconds % 3600 / 60);
NSUInteger seconds = floor(durationSeconds % 3600 % 60);
NSString *time = [NSString stringWithFormat:@"%02ld:%02ld:%02ld", hours, minutes, seconds];
NSLog(@"Time|%@", time);https://stackoverflow.com/questions/9345098
复制相似问题