Add object detection, tracking, mobile notifications, and search to any security camera.
works without timeDifference, except first segment
roryclear09ed01e72131
diff --git a/clearcam/FileServer.m b/clearcam/FileServer.mindex 3a48b93..f76c801 100644--- a/clearcam/FileServer.m+++ b/clearcam/FileServer.m@@ -11,7 +11,6 @@@interface FileServer ()@property (nonatomic, strong) NSString *basePath;@property (nonatomic, strong) NSMutableDictionary *durationCache;-@property (nonatomic, strong) NSMutableDictionary *timeDifferenceCache;@end@implementation FileServerdiff --git a/clearcam/ViewController.m b/clearcam/ViewController.mindex 327dc36..f0cd0a4 100644--- a/clearcam/ViewController.m+++ b/clearcam/ViewController.m@@ -385,12 +385,9 @@ NSMutableDictionary *classColorMap;}if (CMTIME_IS_VALID(self.last_file_duration)) {- CMTime timeDifference = CMTimeMakeWithSeconds([self.current_file_timestamp timeIntervalSinceDate:self.last_file_timestamp], NSEC_PER_SEC);-NSMutableDictionary *segmentEntry = [NSMutableDictionary dictionaryWithDictionary:@{ //does this fix last segment in hour/day?@"url": [NSString stringWithFormat:@"%@/%@", [[self.last_file_url URLByDeletingLastPathComponent] lastPathComponent], self.last_file_url.lastPathComponent],@"duration": @(CMTimeGetSeconds(self.last_file_duration)),- @"timeDifference": @(CMTimeGetSeconds(timeDifference)),@"frames":self.last_segment_squares}];diff --git a/clearcam/player.html b/clearcam/player.htmlindex 8df6e2c..a3e9a55 100644--- a/clearcam/player.html+++ b/clearcam/player.html@@ -439,10 +439,11 @@const oldTotalDuration = totalDuration;let cumulativeStart = totalDuration;- for (let i = 0; i < newSegments.length; i++) {+ for (let i = 0; i < newSegments.length - 1; i++) {const segment = newSegments[i];- const timeDifference = segment.timeDifference || segment.duration;+ const timeDifference = newSegments[i+1].timeStamp - newSegments[i].timeStamp;const lostFrames = timeDifference - segment.duration;+ totalDuration += timeDifference;const currentCumulativeStart = cumulativeStart;cumulativeStart += timeDifference;@@ -454,9 +455,6 @@});}-- totalDuration = segments.reduce((sum, seg) => sum + (seg.timeDifference || seg.duration), 0);-if (totalDuration !== oldTotalDuration) {updateTimeline();preloadNextSegments();