1
0
mirror of https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks.git synced 2025-09-08 07:00:44 +02:00

Add record icon on camera image

This commit is contained in:
gysmo38
2020-05-29 14:24:14 +02:00
committed by Julian Tatsch
parent 53cbc0e9b0
commit 49ee94a06a
3 changed files with 21 additions and 2 deletions

View File

@@ -94,6 +94,9 @@ if [ -n "$F_cmd" ]; then
motion_mqtt_video)
motion_mqtt_video $F_action
;;
recording)
recording $F_action
;;
*)
echo "Unsupported command '$F_cmd'"
;;

View File

@@ -60,6 +60,19 @@ function PTZControl(view) {
}
}
function record(action) {
$.get("cgi-bin/live.cgi",{cmd: "recording", action: action},function (result) {
if (action == "on" || result == "ON\n") {
$("#btn-record span").attr("style","color:red");
$("#btn-record").attr("onclick","record('off')");
}
else {
$("#btn-record span").removeAttr("style");
$("#btn-record").attr("onclick","record('on')");
}
});
}
//Function to show control buttons
function camControl(view) {
if( view == "show") {
@@ -122,6 +135,8 @@ function onLoad() {
$("#hostname").html(hostname);
});
//Get record status
record("status");
// Make liveview self refresh
$("#liveview").attr("onload", "scheduleRefreshJob('live','refreshLiveImage()',1000);");
}

View File

@@ -23,8 +23,9 @@
</div>
<div id="cam-control" class="w3-display-bottomright w3-container w3-hide">
<button id="btn-ptz" class="w3-button w3-circle w3-black" onclick="PTZControl('show')"> <i class="fa fa-arrows-alt"></i></button>
<button id="btn-settings" class="w3-button w3-circle w3-black" onclick="w3_open()"> <i class="fa fa-cog"></i></button>
<button id="btn-record" class="w3-button w3-circle w3-black" onclick="record('on')" title="Record On/Off"><span><i class="fas fa-video"></i></span></button>
<button id="btn-ptz" class="w3-button w3-circle w3-black" onclick="PTZControl('show')" title="PTZ Control"> <i class="fa fa-arrows-alt"></i></button>
<button id="btn-settings" class="w3-button w3-circle w3-black" onclick="w3_open()" title="Camera settings"> <i class="fa fa-cog"></i></button>
<p></p>
</div>
</div>