How To Use Timer To Restart Record Video For Every Preset Interval Time?
Can someone tell me how can i use something like a timer to start a video recording interval process for a period of time (eg: 5mins) then restarts to record another set of 5min vi
Solution 1:
This will start and stop the recording every 5 minutes,
final ServiceRecording recording = ....
final AtomicBoolean started = new AtomicBoolean(false);
ScheduledExecutorService executor = Executors.newScheduledExecutor(1);
executor.scheduleAtFixedRate(new Runnable() {
public void run() {
//only stop if we have started
if(started.get()) {
recording.stop();
} else {
started.set(true);
}
recording.start();
}
}, 5, 5, TimeUnit.MINUTES);
Post a Comment for "How To Use Timer To Restart Record Video For Every Preset Interval Time?"