Add object detection, tracking, mobile notifications, and search to any security camera.
24 hour time
roryclear78920d49c4d9
diff --git a/clearcam/ViewController.m b/clearcam/ViewController.mindex 4d8d73c..7c1a744 100644--- a/clearcam/ViewController.m+++ b/clearcam/ViewController.m@@ -299,13 +299,24 @@ NSMutableDictionary *classColorMap;CMTime timeDifference = CMTimeMakeWithSeconds([self.current_file_timestamp timeIntervalSinceDate:self.last_file_timestamp], NSEC_PER_SEC);// Create a dictionary entry with numeric values- NSDictionary *segmentEntry = @{+ NSMutableDictionary *segmentEntry = [NSMutableDictionary dictionaryWithDictionary:@{@"url": self.last_file_url.lastPathComponent,@"duration": @(CMTimeGetSeconds(self.last_file_duration)),@"timeDifference": @(CMTimeGetSeconds(timeDifference))- };+ }];- [self saveSegmentEntry:segmentEntry toFile:segmentsFilePath]; //todo, not using this yet+ // Add the "timeStamp" field if segmentsArray is empty+ if (self.fileServer.segmentsArray.count == 0) {+ // Calculate timeStamp in seconds since midnight of the same day+ NSCalendar *calendar = [NSCalendar currentCalendar];+ NSDateComponents *components = [calendar components:NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay fromDate:self.current_file_timestamp];+ NSDate *midnight = [calendar dateFromComponents:components];+ NSTimeInterval timeStamp = [self.last_file_timestamp timeIntervalSinceDate:midnight];++ segmentEntry[@"timeStamp"] = @(timeStamp);+ }++ [self saveSegmentEntry:segmentEntry toFile:segmentsFilePath]; // Save to file (not used yet)[self.fileServer.segmentsArray addObject:segmentEntry];// Update last file detailsdiff --git a/clearcam/player.html b/clearcam/player.htmlindex 7e903bd..1a79013 100644--- a/clearcam/player.html+++ b/clearcam/player.html@@ -194,15 +194,17 @@}function formatTime(seconds) {- const minutes = Math.floor(seconds / 60);+ const hours = Math.floor(seconds / 3600).toString().padStart(2, '0');+ const minutes = Math.floor((seconds % 3600) / 60).toString().padStart(2, '0');const secs = Math.floor(seconds % 60).toString().padStart(2, '0');- return `${minutes}:${secs}`;+ return `${hours}:${minutes}:${secs}`;}function updateTimeline() {- const currentTime = currentVideo.currentTime + segments[currentSegment].cumulativeStart;- progressBar.style.width = `${(currentTime / totalDuration) * 100}%`;- timeDisplay.innerText = `${formatTime(currentTime)} / ${formatTime(totalDuration)}`;+ const startTimestamp = segments[0].timeStamp;+ const currentTime = startTimestamp + currentVideo.currentTime + segments[currentSegment].cumulativeStart;+ progressBar.style.width = `${(currentTime - startTimestamp) / totalDuration * 100}%`;+ timeDisplay.innerText = `${formatTime(currentTime)} / ${formatTime(startTimestamp + totalDuration)}`;}function scrub(e) {