-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to stop the stream #2
Comments
Hello, |
Could be this " https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/protocols/esp_http_server.html#_CPPv410httpd_stop14httpd_handle_t " what you are looking for? |
Hello guys, |
Hello, FYI I have implemented a timeout feature in stream_handler() to specify the duration of streaming (eg to save battery) HTH |
Dear Sir,
regarding this coder, once the stream is started, how to you close the stream via software ?
void startCameraServer(){
httpd_config_t config = HTTPD_DEFAULT_CONFIG();
config.server_port = 80;
httpd_uri_t index_uri = {
.uri = "/",
.method = HTTP_GET,
.handler = stream_handler,
.user_ctx = NULL
};
//Serial.printf("Starting web server on port: '%d'\n", config.server_port);
if (httpd_start(&stream_httpd, &config) == ESP_OK) {
httpd_register_uri_handler(stream_httpd, &index_uri);
}
}
Of course i can set the ESP32 in deep sleep which stops the stream, but i am looking for a software method.
Maybe you have some suggestion.
Kind regards
Otto Klaasen
p.s
I change the code like this but when using first call with true and second call with false is does not stop the stream but start a second stream which error out:
bool startCameraServer(bool StartStream){
httpd_config_t config = HTTPD_DEFAULT_CONFIG();
// If startstream is true the stram will work
if (StartStream){
config.server_port = 80;
}
else {
config.server_port = -1;
}
httpd_uri_t index_uri = {
.uri = "/",
.method = _HTTP_GET,
// .method = HTTP_GET, // Original code
.handler = stream_handler,
.user_ctx = NULL
};
//Serial.printf("Starting web server on port: '%d'\n", config.server_port);
if (httpd_start(&stream_httpd, &config) == ESP_OK) {
httpd_register_uri_handler(stream_httpd, &index_uri);
Serial.println("Video Stream started.");
}
else {
Serial.println("Video Stream NOT started.");
}
Serial.print("Stream port: ");Serial.println(config.server_port);
}
The text was updated successfully, but these errors were encountered: