Search code examples
ioscore-dataavfoundationcmtime

Float64 in Core Data?


I'm using CMTime for AVAssets for video clip. To trim the video without saving the new video file I just want to keep track of the start time and the duration.

The CMTimeGetSeconds() method will return a Float64, what would be the best way to store this in CoreData?

I can't use a NSNumber as the float type round the Float64 way to much. 1.200000 is 1.0000 when I create my NSNumber.

Thanks in advance


Solution

  • Based on your comments it is highly likely that that the videoTrack object will adjust the duration to a nice round number that makes since for video playback. Try creating an NSNumber and printing it without setting it to the duration property and you will probably get the exact same result. Also make sure the data type is set to a Double in the CoreData model.