Skip to content
This repository was archived by the owner on Aug 16, 2024. It is now read-only.

Commit 0ba633a

Browse files
authored
Merge pull request #36 from fwestenberg/RTMP-password-option
RTMP auth method
2 parents 1b5c938 + bc21d6e commit 0ba633a

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

reolink/camera_api.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
DEFAULT_CHANNEL = 0
1818
DEFAULT_TIMEOUT = 30
1919
DEFAULT_STREAM_FORMAT = "h264"
20-
DEFAULT_STREAM_USE_PASS = True
20+
DEFAULT_RTMP_AUTH_METHOD = 'PASSWORD'
2121

2222
_LOGGER = logging.getLogger(__name__)
2323

@@ -36,7 +36,7 @@ def __init__(
3636
stream=DEFAULT_STREAM,
3737
timeout=DEFAULT_TIMEOUT,
3838
stream_format=DEFAULT_STREAM_FORMAT,
39-
stream_use_pass=DEFAULT_STREAM_USE_PASS,
39+
rtmp_auth_method=DEFAULT_RTMP_AUTH_METHOD,
4040
):
4141
"""Initialize the API class."""
4242
self._url = f"http://{host}:{port}/cgi-bin/api.cgi"
@@ -48,7 +48,7 @@ def __init__(
4848
self._stream = stream
4949
self._protocol = protocol
5050
self._stream_format = stream_format
51-
self._stream_use_pass = stream_use_pass
51+
self._rtmp_auth_method = rtmp_auth_method
5252
self._timeout = aiohttp.ClientTimeout(total=timeout)
5353

5454
self._token = None
@@ -437,7 +437,7 @@ async def get_stream_source(self):
437437
return
438438

439439
if self.protocol == DEFAULT_PROTOCOL:
440-
if self.stream_use_pass == DEFAULT_STREAM_USE_PASS:
440+
if self._rtmp_auth_method == DEFAULT_RTMP_AUTH_METHOD:
441441
stream_source = f"rtmp://{self._host}:{self._rtmp_port}/bcs/channel{self._channel}_{self._stream}.bcs?channel={self._channel}&stream=0&user={self._username}&password={self._password}"
442442
else:
443443
stream_source = f"rtmp://{self._host}:{self._rtmp_port}/bcs/channel{self._channel}_{self._stream}.bcs?channel={self._channel}&stream=0&token={self._token}"

0 commit comments

Comments
 (0)