Esto puede parecer ridículo, pero ¿cómo puedo sacar los segundos de CMTime a la consola en Objective-C? Simplemente necesito el valor dividido por la escala de tiempo y luego de alguna manera lo veo en la consola.CMTime seconds output
46
A
Respuesta
128
NSLog(@"seconds = %f", CMTimeGetSeconds(cmTime));
12
4
Si desea convertir en formato hh:mm:ss
continuación, puede utilizar esta
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);
0
CMTime currentTime = audioPlayer.currentItem.currentTime;
float videoDurationSeconds = CMTimeGetSeconds(currentTime);
Cuestiones relacionadas
- 1. MYSQL - datetime to seconds
- 2. Intentando comprender CMTime y CMTimeMake
- 3. Oracle current_timestamp to seconds conversion
- 4. objetivoC/CMTime - convierte AVPlayer.duration en milisegundos
- 5. AVFoundation - Retiming CMSampleBufferRef Video Output
- 6. Log4net xml output
- 7. Explaining readelf -S output
- 8. Junit output y OutOfMemoryError
- 9. upstart logging output enabled
- 10. gcc assembly output
- 11. Zend Framework JSON Output
- 12. Indenting Bash Script Output
- 13. Python tarfile progress output?
- 14. typeinfo/typeid output
- 15. Bash Output Tables
- 16. GDAL Raster Output
- 17. PHP HTML image output
- 18. Log Output en DBUnit
- 19. Paging output from python
- 20. PHP Output Buffering
- 21. Unit Testing show output
- 22. Convirtiendo CMTime a tiempo legible para humanos en Object-C
- 23. Logging from output in Perl
- 24. JasperReports html y pdf output
- 25. stanford core nlp java output
- 26. anexar subproceso.Popen output to file?
- 27. cómo estilo php echo output
- 28. git stderr output no pipe
- 29. data.table vs plyr regression output
- 30. capture process output in Groovy
¿qué tal si CMTimeGetSeconds devuelve NaN? – BUDDAx2
Supongo que la entrada es una de las constantes ['CMTime'] (https://developer.apple.com/library/IOs/documentation/CoreMedia/Reference/CMTime/index.html#//apple_ref/doc/constant_group/Time_Constants) (probablemente no 'kCMTimeZero'). Intenta usar 'CMTimeShow' para ver cuáles son sus campos. –
verificar para "duración> 0" funciona para mí – BUDDAx2