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

Commit

Permalink
Merge pull request #36 from fwestenberg/RTMP-password-option
Browse files Browse the repository at this point in the history
RTMP auth method
  • Loading branch information
fwestenberg authored Jul 21, 2021
2 parents 1b5c938 + bc21d6e commit 0ba633a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions reolink/camera_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
DEFAULT_CHANNEL = 0
DEFAULT_TIMEOUT = 30
DEFAULT_STREAM_FORMAT = "h264"
DEFAULT_STREAM_USE_PASS = True
DEFAULT_RTMP_AUTH_METHOD = 'PASSWORD'

_LOGGER = logging.getLogger(__name__)

Expand All @@ -36,7 +36,7 @@ def __init__(
stream=DEFAULT_STREAM,
timeout=DEFAULT_TIMEOUT,
stream_format=DEFAULT_STREAM_FORMAT,
stream_use_pass=DEFAULT_STREAM_USE_PASS,
rtmp_auth_method=DEFAULT_RTMP_AUTH_METHOD,
):
"""Initialize the API class."""
self._url = f"http://{host}:{port}/cgi-bin/api.cgi"
Expand All @@ -48,7 +48,7 @@ def __init__(
self._stream = stream
self._protocol = protocol
self._stream_format = stream_format
self._stream_use_pass = stream_use_pass
self._rtmp_auth_method = rtmp_auth_method
self._timeout = aiohttp.ClientTimeout(total=timeout)

self._token = None
Expand Down Expand Up @@ -437,7 +437,7 @@ async def get_stream_source(self):
return

if self.protocol == DEFAULT_PROTOCOL:
if self.stream_use_pass == DEFAULT_STREAM_USE_PASS:
if self._rtmp_auth_method == DEFAULT_RTMP_AUTH_METHOD:
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}"
else:
stream_source = f"rtmp://{self._host}:{self._rtmp_port}/bcs/channel{self._channel}_{self._stream}.bcs?channel={self._channel}&stream=0&token={self._token}"
Expand Down

0 comments on commit 0ba633a

Please sign in to comment.