mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-27 20:56:35 +00:00
Update xdrv_81_esp32_webcam.ino (#18637)
This commit is contained in:
parent
11bf16d162
commit
79a826a206
@ -974,14 +974,14 @@ uint32_t WcSetStreamserver(uint32_t flag) {
|
|||||||
|
|
||||||
void WcInterruptControl() {
|
void WcInterruptControl() {
|
||||||
WcSetStreamserver(Settings->webcam_config.stream);
|
WcSetStreamserver(Settings->webcam_config.stream);
|
||||||
WcSetup(Settings->webcam_config.resolution);
|
if(Wc.up != 0) {WcSetup(Settings->webcam_config.resolution);}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************************************/
|
/*********************************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
void WcLoop(void) {
|
void WcLoop(void) {
|
||||||
if (4 == Wc.stream_active) { return; }
|
// if (4 == Wc.stream_active) { return; }
|
||||||
|
|
||||||
if (Wc.CamServer) {
|
if (Wc.CamServer) {
|
||||||
Wc.CamServer->handleClient();
|
Wc.CamServer->handleClient();
|
||||||
@ -1042,11 +1042,10 @@ void WcShowStream(void) {
|
|||||||
// if (!Wc.CamServer || !Wc.up) {
|
// if (!Wc.CamServer || !Wc.up) {
|
||||||
if (!Wc.CamServer) {
|
if (!Wc.CamServer) {
|
||||||
WcInterruptControl();
|
WcInterruptControl();
|
||||||
delay(50); // Give the webcam webserver some time to prepare the stream
|
|
||||||
}
|
}
|
||||||
if (Wc.CamServer && Wc.up) {
|
if (Wc.CamServer && Wc.up!=0) {
|
||||||
WSContentSend_P(PSTR("<p></p><center><img src='http://%_I:81/stream' alt='Webcam stream' style='width:99%%;'></center><p></p>"),
|
// Give the webcam webserver some time to prepare the stream - catch error in JS
|
||||||
(uint32_t)WiFi.localIP());
|
WSContentSend_P(PSTR("<p></p><center><img onerror='setTimeout(()=>{this.src=this.src;},1000)' src='http://%_I:81/stream' alt='Webcam stream' style='width:99%%;'></center><p></p>"),(uint32_t)WiFi.localIP());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1383,6 +1382,7 @@ void CmndWebcamClock(void){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CmndWebcamInit(void) {
|
void CmndWebcamInit(void) {
|
||||||
|
Wc.up = 0;
|
||||||
WcInterruptControl();
|
WcInterruptControl();
|
||||||
ResponseCmndDone();
|
ResponseCmndDone();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user