Skip to content

Add object detection, tracking, mobile notifications, and search to any security camera.

hours seem to work now

roryclear5c7c87d51388
diff --git a/clearcam/ViewController.m b/clearcam/ViewController.m
index b3c164e..ab1b0e3 100644
--- a/clearcam/ViewController.m
+++ b/clearcam/ViewController.m
@@ -338,8 +338,8 @@ NSMutableDictionary *classColorMap;
} else {
CMTime timeDifference = CMTimeMakeWithSeconds([self.current_file_timestamp timeIntervalSinceDate:self.last_file_timestamp], NSEC_PER_SEC);
- NSMutableDictionary *segmentEntry = [NSMutableDictionary dictionaryWithDictionary:@{
- @"url": [NSString stringWithFormat:@"%@/%@", [[self.assetWriter.outputURL URLByDeletingLastPathComponent] lastPathComponent], self.last_file_url.lastPathComponent],
+ 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))
}];
diff --git a/clearcam/player.html b/clearcam/player.html
index 4b5e059..7037f70 100644
--- a/clearcam/player.html
+++ b/clearcam/player.html
@@ -200,11 +200,19 @@
function updateTimeline() {
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)}`;
- }
+ let adjustedStartTimestamp;
+
+ if (startTimestamp < 0) {
+ adjustedStartTimestamp = (24 * 3600) + startTimestamp; //todo hack?
+ } else {
+ adjustedStartTimestamp = startTimestamp;
+ }
+ const currentTime = adjustedStartTimestamp + currentVideo.currentTime + segments[currentSegment].cumulativeStart;
+ progressBar.style.width = `${(currentTime - adjustedStartTimestamp) / totalDuration * 100}%`;
+ timeDisplay.innerText = `${formatTime(currentTime)} / ${formatTime(adjustedStartTimestamp + totalDuration)}`;
+ }
+
videoContainer.addEventListener('mousemove', showControls);
videoContainer.addEventListener('mouseleave', hideControls);
videoContainer.addEventListener('touchend', toggleControls);