Skip to content

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

download modal

roryclearbcb909e0e3f2
diff --git a/experimental/clearcam_rtsp.py b/experimental/clearcam_rtsp.py
index 0c536f6..65852c6 100644
--- a/experimental/clearcam_rtsp.py
+++ b/experimental/clearcam_rtsp.py
@@ -1268,12 +1268,48 @@ class HLSRequestHandler(BaseHTTPRequestHandler):
margin-top: 20px;
}}
+ .download-modal {{
+ display: none;
+ position: fixed;
+ z-index: 1;
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 100%;
+ background-color: rgba(0,0,0,0.4);
+ }}
+
+ .download-modal-content {{
+ background-color: #fefefe;
+ margin: 15% auto;
+ padding: 20px;
+ border-radius: 8px;
+ width: 80%;
+ max-width: 500px;
+ box-shadow: 0 4px 8px rgba(0,0,0,0.1);
+ }}
+
+ .download-controls {{
+ display: flex;
+ flex-direction: column;
+ gap: 15px;
+ }}
+
+ .download-time-inputs {{
+ display: flex;
+ gap: 10px;
+ }}
+
@media (max-width: 600px) {{
.controls {{
flex-direction: column;
align-items: center;
}}
+ .download-time-inputs {{
+ flex-direction: column;
+ }}
+
.time-inputs {{
flex-direction: row;
justify-content: center;
@@ -1347,16 +1383,32 @@ class HLSRequestHandler(BaseHTTPRequestHandler):
<input type="date" id="folderPicker" value="{selected_dir}">
</label>
<div class="download-section">
- <div id="downloadControls" class="collapsible download-controls">
- <label>
- Start:
- <input type="time" id="clipStart" step="1" value="00:00:00">
- </label>
- <label>
- End:
- <input type="time" id="clipEnd" step="1" value="00:00:10">
- </label>
- <button onclick="downloadClip()">Download Now</button>
+ <button onclick="openDownloadModal()">Download Clip</button>
+ </div>
+
+ <!-- Download Modal -->
+ <div id="downloadModal" class="download-modal">
+ <div class="download-modal-content">
+ <div class="modal-header">
+ <h3>Download Clip</h3>
+ <span class="close" onclick="closeDownloadModal()">&times;</span>
+ </div>
+ <div class="download-controls">
+ <div class="download-time-inputs">
+ <div class="form-group">
+ <label for="clipStart">Start Time</label>
+ <input type="time" id="clipStart" step="1" value="00:00:00">
+ </div>
+ <div class="form-group">
+ <label for="clipEnd">End Time</label>
+ <input type="time" id="clipEnd" step="1" value="00:00:10">
+ </div>
+ </div>
+ <div class="form-actions">
+ <button type="button" onclick="closeDownloadModal()">Cancel</button>
+ <button type="button" onclick="downloadClip()">Download Now</button>
+ </div>
+ </div>
</div>
</div>
@@ -1394,6 +1446,22 @@ class HLSRequestHandler(BaseHTTPRequestHandler):
}}
}}
+ function openDownloadModal() {{
+ document.getElementById('downloadModal').style.display = 'block';
+ }}
+
+ function closeDownloadModal() {{
+ document.getElementById('downloadModal').style.display = 'none';
+ }}
+
+ // Close modal when clicking outside
+ window.onclick = function(event) {{
+ const modal = document.getElementById('downloadModal');
+ if (event.target == modal) {{
+ closeDownloadModal();
+ }}
+ }}
+
const folderPicker = document.getElementById("folderPicker");
const video = document.getElementById("video");
const startTime = {start_time if start_time is not None else 'null'};