Specify rtsp_transport for Onvif Camera (#31918)

* specify rtsp_transport for onvif camera

* remove used variable

* Update homeassistant/components/stream/__init__.py

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

* change options to stream_options

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
Rami Mosleh 2020-03-06 19:59:57 +02:00 committed by GitHub
parent ac945242dc
commit e1cc2acdf9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 11 deletions

View file

@ -50,13 +50,12 @@ def request_stream(hass, stream_source, *, fmt="hls", keepalive=False, options=N
options = {}
# For RTSP streams, prefer TCP
if (
isinstance(stream_source, str)
and stream_source[:7] == "rtsp://"
and not options
):
options["rtsp_flags"] = "prefer_tcp"
options["stimeout"] = "5000000"
if isinstance(stream_source, str) and stream_source[:7] == "rtsp://":
options = {
"rtsp_flags": "prefer_tcp",
"stimeout": "5000000",
**options,
}
try:
streams = hass.data[DOMAIN][ATTR_STREAMS]