0

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

normidar
  • 445
  • 5
  • 11

1 Answers1

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