ari*_*rik 55 console objective-c cmtime
这可能看起来很荒谬,但是如何在Objective-C中将CMTime的秒数输出到控制台?我只需要将值除以时间刻度,然后以某种方式在控制台中看到它.
rob*_*off 146
NSLog(@"seconds = %f", CMTimeGetSeconds(cmTime));
Run Code Online (Sandbox Code Playgroud)
0xD*_*15B 14
简单:
NSLog(@"%lld", time.value/time.timescale);
Run Code Online (Sandbox Code Playgroud)
如果您想以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);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
33163 次 |
| 最近记录: |