Reputation: 120
I can’t seem to figure out how to convert TimeInterval to CMTime. Does it need more than just a simple conversion method?
Upvotes: 8
Views: 8336
Reputation: 47876
You can write something like this:
let timeIntvl: TimeInterval = 60
let cmTime = CMTime(seconds: timeIntvl, preferredTimescale: 1000000)
1000000
represents that the preferred Timescale is 1μsec (1/1000000 sec).
When you convert between some types, there's usually no simple conversion method and you may need to find an initializer of the destination type.
init(seconds: Double, preferredTimescale: CMTimeScale)
Upvotes: 20