Skip to content

Commit 7115b0d

Browse files
committed
Removing 'active' param from mute_all and disable_force_mute methods
1 parent bff41fc commit 7115b0d

File tree

1 file changed

+30
-37
lines changed

1 file changed

+30
-37
lines changed

opentok/opentok.py

Lines changed: 30 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ def create_session(
407407
proxies=self.proxies,
408408
timeout=self.timeout,
409409
)
410-
410+
411411
response.encoding = "utf-8"
412412

413413
if response.status_code == 403:
@@ -754,13 +754,13 @@ def list_archives(self, offset=None, count=None, session_id=None):
754754
return self.get_archives(offset, count, session_id)
755755

756756
def add_archive_stream(
757-
self,
757+
self,
758758
archive_id: str,
759759
stream_id: str,
760760
has_audio: bool = True,
761-
has_video: bool = True
761+
has_video: bool = True
762762
) -> requests.Response:
763-
763+
764764
"""
765765
This method will add streams to the archive with addStream for new participant(choosing audio, video or both).
766766
@@ -1122,14 +1122,14 @@ def dial(self, session_id, token, sip_uri, options=[]):
11221122
Boolean 'secure': A Boolean flag that indicates whether the media must be transmitted
11231123
encrypted (true) or not (false, the default)
11241124
1125-
Boolean 'observeForceMute': A Boolean flag that determines whether the SIP endpoint should
1126-
honor the force mute action. The force mute action allows a moderator to force clients to
1127-
mute audio in streams they publish. It defaults to False if moderator does not want to observe
1125+
Boolean 'observeForceMute': A Boolean flag that determines whether the SIP endpoint should
1126+
honor the force mute action. The force mute action allows a moderator to force clients to
1127+
mute audio in streams they publish. It defaults to False if moderator does not want to observe
11281128
force mute a stream and set to True if the moderator wants to observe force mute a stream.
11291129
11301130
Boolean 'video': A Boolean flag that indicates whether the SIP call will include video(true)
1131-
or not(false, which is the default). With video included, the SIP client's video is included
1132-
in the OpenTok stream that is sent to the OpenTok session. The SIP client will receive a single
1131+
or not(false, which is the default). With video included, the SIP client's video is included
1132+
in the OpenTok stream that is sent to the OpenTok session. The SIP client will receive a single
11331133
composed video of the published streams in the OpenTok session.
11341134
11351135
This is an example of what the payload POST data body could look like:
@@ -1154,7 +1154,7 @@ def dial(self, session_id, token, sip_uri, options=[]):
11541154
}
11551155
11561156
1157-
:rtype: A SipCall object, which contains data of the SIP call: id, connectionId and streamId.
1157+
:rtype: A SipCall object, which contains data of the SIP call: id, connectionId and streamId.
11581158
This is what the response body should look like after returning with a status code of 200:
11591159
11601160
{
@@ -1184,7 +1184,7 @@ def dial(self, session_id, token, sip_uri, options=[]):
11841184
if "observeForceMute" in options:
11851185
observeForceMute = True
11861186
payload["sip"]["observeForceMute"] = options["observeForceMute"]
1187-
1187+
11881188
if "video" in options:
11891189
video = True
11901190
payload["sip"]["video"] = options["video"]
@@ -1382,7 +1382,7 @@ def stop_broadcast(self, broadcast_id):
13821382
self.json_headers(),
13831383
self.proxies,
13841384
)
1385-
1385+
13861386
response = requests.post(
13871387
endpoint,
13881388
headers=self.get_json_headers(),
@@ -1408,13 +1408,13 @@ def stop_broadcast(self, broadcast_id):
14081408
raise RequestError("OpenTok server error.", response.status_code)
14091409

14101410
def add_broadcast_stream(
1411-
self,
1411+
self,
14121412
broadcast_id: str,
14131413
stream_id: str,
14141414
has_audio: bool = True,
1415-
has_video: bool = True
1415+
has_video: bool = True
14161416
) -> requests.Response:
1417-
1417+
14181418
"""
14191419
This method will add streams to the broadcast with addStream for new participant(choosing audio, video or both).
14201420
@@ -1462,7 +1462,7 @@ def add_broadcast_stream(
14621462
else:
14631463
raise RequestError("OpenTok server error.", response.status_code)
14641464

1465-
1465+
14661466
def remove_broadcast_stream(self, broadcast_id: str, stream_id: str) -> requests.Response:
14671467
"""
14681468
This method will remove streams from the broadcast with removeStream.
@@ -1616,8 +1616,8 @@ def _create_jwt_auth_header(self):
16161616
}
16171617

16181618
return jwt.encode(payload, self.api_secret, algorithm="HS256")
1619-
1620-
1619+
1620+
16211621

16221622
class OpenTok(Client):
16231623
def __init__(
@@ -1641,10 +1641,9 @@ def __init__(
16411641
app_version=app_version
16421642
)
16431643

1644-
def mute_all(self,
1645-
session_id: str,
1646-
excludedStreamIds: Optional[List[str]],
1647-
active: bool= True) -> requests.Response:
1644+
def mute_all(self,
1645+
session_id: str,
1646+
excludedStreamIds: Optional[List[str]]) -> requests.Response:
16481647

16491648
"""
16501649
Mutes all streams in an OpenTok session.
@@ -1653,22 +1652,19 @@ def mute_all(self,
16531652
16541653
:param session_id The session ID
16551654
1656-
:param excludedStreamIds A list of stream IDs for streams that should not be muted.
1655+
:param excludedStreamIds A list of stream IDs for streams that should not be muted.
16571656
This is an optional property. If you omit this property, all streams in the session will be muted.
1658-
1659-
:param active Whether streams published after the call, in addition to the current streams
1660-
in the session, should be muted (True).
16611657
"""
16621658

16631659
options = {}
16641660
url = self.endpoints.get_mute_all_url(session_id)
16651661

16661662
try:
16671663
if excludedStreamIds:
1668-
options = {'active': active, 'excludedStreams': excludedStreamIds }
1664+
options = {'active': True, 'excludedStreams': excludedStreamIds }
16691665
else:
1670-
options = {'active': active, 'excludedStreams': []}
1671-
1666+
options = {'active': True, 'excludedStreams': []}
1667+
16721668
response = requests.post(url, headers=self.get_headers(), data=json.dumps(options))
16731669

16741670
if response:
@@ -1684,20 +1680,18 @@ def mute_all(self,
16841680
("There was an error thrown by the OpenTok SDK, please check that your session_id {0} and excludedStreamIds (if exists) {1} are valid").format(
16851681
session_id, excludedStreamIds))
16861682

1687-
1688-
def disable_force_mute(self, session_id: str, active: bool= False) -> requests.Response:
1683+
1684+
def disable_force_mute(self, session_id: str) -> requests.Response:
16891685
"""
16901686
Disables the mute all streams in an OpenTok session.
16911687
16921688
:param session_id The session ID.
1693-
1694-
:param active Whether streams published after the call, in addition to the current streams
1695-
in the session, should not be muted (False).
16961689
"""
16971690

1691+
options = {'active': False}
16981692
url = self.endpoints.get_mute_all_url(session_id)
16991693

1700-
response = requests.post(url, headers=self.get_headers())
1694+
response = requests.post(url, headers=self.get_headers(), data=json.dumps(options))
17011695

17021696

17031697
try:
@@ -1713,7 +1707,7 @@ def disable_force_mute(self, session_id: str, active: bool= False) -> requests.R
17131707
raise OpenTokException(
17141708
("There was an error thrown by the OpenTok SDK, please check that your session_id {0} is valid").format(
17151709
session_id))
1716-
1710+
17171711

17181712
def mute_stream(self, session_id: str, stream_id: str) -> requests.Response:
17191713
"""
@@ -1781,4 +1775,3 @@ def play_dtmf(self, session_id: str, connection_id: str, digits: str, options: d
17811775
except Exception as e:
17821776
raise OpenTokException(
17831777
(f"There was an error thrown by the OpenTok SDK, please check that your session_id: {session_id}, connection_id (if exists): {connection_id} and digits: {digits} are valid"))
1784-

0 commit comments

Comments
 (0)