Add object detection, tracking, mobile notifications, and search to any security camera.
use metadata for rotation...not js
roryclear255a8e5edca8
diff --git a/clearcam/ViewController.m b/clearcam/ViewController.mindex f32b3d3..b5317b5 100644--- a/clearcam/ViewController.m+++ b/clearcam/ViewController.m@@ -200,8 +200,11 @@ NSMutableDictionary *classColorMap;self.videoWriterInput.expectsMediaDataInRealTime = YES;if(self.previewLayer.connection.videoOrientation == AVCaptureVideoOrientationPortrait){self.videoWriterInput.transform = CGAffineTransformMakeRotation(M_PI_2);//does this work?+ } else if (self.previewLayer.connection.videoOrientation == AVCaptureVideoOrientationLandscapeLeft) {+ self.videoWriterInput.transform = CGAffineTransformMakeRotation(M_PI);}+NSDictionary *sourcePixelBufferAttributes = @{(NSString *)kCVPixelBufferPixelFormatTypeKey: @(kCVPixelFormatType_32BGRA),(NSString *)kCVPixelBufferWidthKey: @1280,@@ -666,5 +669,3 @@ NSMutableDictionary *classColorMap;}@end--diff --git a/clearcam/player.html b/clearcam/player.htmlindex 0b84a10..393eae2 100644--- a/clearcam/player.html+++ b/clearcam/player.html@@ -783,9 +783,6 @@function playSegment() {if (segments.length > 0) {- if(segments[currentSegment].orientation){- setVideoOrientation(segments[currentSegment].orientation);- }videoPlayers[video_index].src = segments[currentSegment].url;videoPlayers[video_index].currentTime = 0;videoPlayers[video_index].style.display = "block";@@ -803,9 +800,6 @@function switchToNextSegment() {if (currentSegment + 1 < segments.length) {currentSegment++;- if(segments[currentSegment].orientation){- setVideoOrientation(segments[currentSegment].orientation);- }is_prepared[video_index] = false;video_index = (video_index + 1) % videoPlayers.length;for(let i = 1; i < videoPlayers.length; i++){@@ -971,32 +965,8 @@function showBoundingBoxes() {document.querySelectorAll(".bounding-box").forEach(box => box.style.display = "");}-- let rotationAngle = 0;-- // Function to rotate the video container based on orientation- function setVideoOrientation(orientation) {- let rotationAngle = 0; // Default to landscape_right (0°)- switch (orientation) {- case 'landscape_left':- rotationAngle = 180;- break;- case 'portrait':- rotationAngle = 90;- break;- }- const videoContainer = document.getElementById('videoContainer');- for(let i = 0; i < document.querySelectorAll(".videoPlayer").length; i++){- document.querySelectorAll(".videoPlayer")[i].style.transform = `rotate(${rotationAngle}deg)`;- }- //videoContainer.style.transform = `rotate(${rotationAngle}deg)`;- if (rotationAngle % 180 !== 0) {- videoContainer.style.aspectRatio = '3 / 4'; // Portrait orientation- } else {- videoContainer.style.aspectRatio = '4 / 3'; // Landscape orientation- }- }</script></body></html>+