Lets assume I have a CMTimeRange
constructed from start time
zero, and
duration
of 40 seconds.
I want to split this CMTimeRange
into multiple chunks by a X seconds divider. So the total duration
of the chunks will be the same duration
as the original duration, and each startTime
will reflect the endTime
of of the previous chunk. The last chunk will be the modulus of the left over seconds.
For example, for video of 40 seconds, and divider of 15 seconds per chunk:
- First
CMTimeRange
- start time: 0, duration: 15 seconds. - Second
CMTimeRange
- start time: 15, duration: 15 seconds. - Third
CMTimeRange
- start time: 30, duration: 10 seconds.(left overs)
What I've tried:
I tried using CMTimeSubtract
on the total duration and use the result again, in recursive way untill the CMTime in invalid, But it doesn't seems to work.
Any help will be highly appreciated.
Best Regards, Roi