Add object detection, tracking, mobile notifications, and search to any security camera.
start orientation
roryclear2a88d7cfe73d
diff --git a/clearcam/ViewController.m b/clearcam/ViewController.mindex 9f10c40..6e9e06e 100644--- a/clearcam/ViewController.m+++ b/clearcam/ViewController.m@@ -16,6 +16,7 @@@property (atomic, assign) BOOL isProcessing;@property (nonatomic, assign) BOOL isRecording;+@property (nonatomic, assign) BOOL orientation_changed;@property (nonatomic, assign) CMTime startTime;@property (nonatomic, assign) CMTime currentTime;@property (nonatomic, strong) AVAssetWriter *assetWriter;@@ -50,6 +51,7 @@ NSMutableDictionary *classColorMap;self.digits[@"-"] = @[@[ @0, @2, @3, @1 ]];self.digits[@":"] = @[@[ @1, @1, @1, @1 ], @[ @1, @3, @1, @1 ]];[[NSFileManager defaultManager] removeItemAtPath:[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject stringByAppendingPathComponent:@"segments.txt"] error:nil]; //TODO remove+ self.orientation_changed = FALSE;//TODO REMOVE THISNSFileManager *fileManager = [NSFileManager defaultManager];@@ -102,9 +104,9 @@ NSMutableDictionary *classColorMap;}- (void)handleDeviceOrientationChange {+ self.orientation_changed = TRUE;UIDeviceOrientation deviceOrientation = [[UIDevice currentDevice] orientation];AVCaptureVideoOrientation videoOrientation;-switch (deviceOrientation) {case UIDeviceOrientationLandscapeLeft:videoOrientation = AVCaptureVideoOrientationLandscapeRight;@@ -385,8 +387,17 @@ NSMutableDictionary *classColorMap;@"duration": @(CMTimeGetSeconds(time)),@"frames":[self.current_segment_squares copy]}];-- NSMutableArray *segmentsForDate = self.fileServer.segmentsDict[dateKey];++ if(self.orientation_changed){+ if(self.previewLayer.connection.videoOrientation == AVCaptureVideoOrientationLandscapeRight){+ segmentEntry[@"orientation"] = @"landscape_right";+ } else if(self.previewLayer.connection.videoOrientation == AVCaptureVideoOrientationLandscapeLeft){+ segmentEntry[@"orientation"] = @"landscape_left";+ } else { //todo upside down!+ segmentEntry[@"orientation"] = @"portait";+ }+ self.orientation_changed = FALSE;+ }//timestamp of every segment nowcalendar = [NSCalendar currentCalendar];diff --git a/clearcam/player.html b/clearcam/player.htmlindex 1a7d80f..14119de 100644--- a/clearcam/player.html+++ b/clearcam/player.html@@ -783,6 +783,9 @@function playSegment() {if (segments.length > 0) {+ if(segments[currentSegment].orientation){+ alert("ROTATED?");+ }videoPlayers[video_index].src = segments[currentSegment].url;videoPlayers[video_index].currentTime = 0;videoPlayers[video_index].style.display = "block";@@ -800,6 +803,9 @@function switchToNextSegment() {if (currentSegment + 1 < segments.length) {currentSegment++;+ if(segments[currentSegment].orientation){+ alert("ROTATED???");+ }is_prepared[video_index] = false;video_index = (video_index + 1) % videoPlayers.length;for(let i = 1; i < videoPlayers.length; i++){