How to addd user value to CMTimeMakeWithSecondValue

266 views Asked by At

Stop motion app

Trying to get frame duration (/.5)set by users value received from a stepper: self.stepperValue;

Original settings hard coded value of five frames a second

// 5 fps - taking 5 pictures will equal 1 second of video
frameDuration = CMTimeMakeWithSeconds(1./5., 90000);

Now trying with frames per second determined by stepper value, What I've tried so far (stepperValue is being read correctly)

 int x = self.stepperValue;
 frameDuration = CMTimeMakeWithSeconds(1./x, 90000);

This results on nothing being captured

second attempt

 float a = ([_stepperValue.text floatValue]);


// 5 fps - taking 5 pictures will equal 1 second of video
frameDuration = CMTimeMakeWithSeconds(1./a, 90000);

This results in a standard 5 frames per second value no matter value is entered form the stepper

1

There are 1 answers

0
JSA986 On

Fixed this

 Float64 seconds = ([_stepperValue.text floatValue]);

 frameDuration = CMTimeMakeWithSeconds(1./seconds, 90000);