1717DEFAULT_CHANNEL = 0
1818DEFAULT_TIMEOUT = 30
1919DEFAULT_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