iOS how can I get CMTime from Int64 that create by Date().timeIntervalSince1970

263 Views Asked by At

As same as the title I am get a Timestamp by Date().timeIntervalSince1970 how can I transform it to CMTime?

1

There are 1 best solutions below

0
normidar On
extension TimeInterval {
    func toCMTime() -> CMTime {
        let scale = CMTimeScale(NSEC_PER_SEC)
        let rt = CMTime(value: CMTimeValue(self * Double(scale)), timescale: scale)
        return rt
    }
}