ios - show record timer while making video -
i had implemented concept of avcapturesession recording video.
-(void)startrecordingwithorientation:(avcapturevideoorientation)videoorientation { avcaptureconnection *videoconnection = [avcamutilities connectionwithmediatype:avmediatypevideo fromconnections:[[self moviefileoutput] connections]]; if ([videoconnection isvideoorientationsupported]) [videoconnection setvideoorientation:videoorientation]; [[self moviefileoutput] startrecordingtooutputfileurl:[self outputfileurl] recordingdelegate:self]; }
it recording video recording timer in not there on screen. has idea how show timer while making video.
thanks in advance.
i use add uilabel view presented video while recording , use code show record time
@property (weak, nonatomic) iboutlet uilabel *labeltime; @property(nonatomic, strong) nstimer *timer; @property(nonatomic) int timesec; @property(nonatomic) int timemin;
//method start recording
- (void)startrecord { self.timemin = 0; self.timesec = 0; //string format 00:00 nsstring* timenow = [nsstring stringwithformat:@"%02d:%02d", self.timemin, self.timesec]; //display on label //[timelabel setstringvalue:timenow]; self.labeltime.text= timenow; self.timer = [nstimer scheduledtimerwithtimeinterval:1.0 target:self selector:@selector(timertick:) userinfo:nil repeats:yes]; [[nsrunloop currentrunloop] addtimer:self.timer formode:nsdefaultrunloopmode]; //start recording [moviefileoutput startrecordingtooutputfileurl:outputurl recordingdelegate:self]; } //event called every time nstimer ticks. - (void)timertick:(nstimer *)timer { self.timesec++; if (self.timesec == 60) { self.timesec = 0; self.timemin++; } //string format 00:00 nsstring* timenow = [nsstring stringwithformat:@"%02d:%02d", self.timemin, self.timesec]; //display on label self.labeltime.text= timenow; }
Comments
Post a Comment