8

I can’t seem to figure out how to convert TimeInterval to CMTime. Does it need more than just a simple conversion method?

1 Answer 1

20

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)

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.