@@ -407,7 +407,7 @@ def create_session(
407
407
proxies = self .proxies ,
408
408
timeout = self .timeout ,
409
409
)
410
-
410
+
411
411
response .encoding = "utf-8"
412
412
413
413
if response .status_code == 403 :
@@ -754,13 +754,13 @@ def list_archives(self, offset=None, count=None, session_id=None):
754
754
return self .get_archives (offset , count , session_id )
755
755
756
756
def add_archive_stream (
757
- self ,
757
+ self ,
758
758
archive_id : str ,
759
759
stream_id : str ,
760
760
has_audio : bool = True ,
761
- has_video : bool = True
761
+ has_video : bool = True
762
762
) -> requests .Response :
763
-
763
+
764
764
"""
765
765
This method will add streams to the archive with addStream for new participant(choosing audio, video or both).
766
766
@@ -1122,14 +1122,14 @@ def dial(self, session_id, token, sip_uri, options=[]):
1122
1122
Boolean 'secure': A Boolean flag that indicates whether the media must be transmitted
1123
1123
encrypted (true) or not (false, the default)
1124
1124
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
1128
1128
force mute a stream and set to True if the moderator wants to observe force mute a stream.
1129
1129
1130
1130
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
1133
1133
composed video of the published streams in the OpenTok session.
1134
1134
1135
1135
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=[]):
1154
1154
}
1155
1155
1156
1156
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.
1158
1158
This is what the response body should look like after returning with a status code of 200:
1159
1159
1160
1160
{
@@ -1184,7 +1184,7 @@ def dial(self, session_id, token, sip_uri, options=[]):
1184
1184
if "observeForceMute" in options :
1185
1185
observeForceMute = True
1186
1186
payload ["sip" ]["observeForceMute" ] = options ["observeForceMute" ]
1187
-
1187
+
1188
1188
if "video" in options :
1189
1189
video = True
1190
1190
payload ["sip" ]["video" ] = options ["video" ]
@@ -1382,7 +1382,7 @@ def stop_broadcast(self, broadcast_id):
1382
1382
self .json_headers (),
1383
1383
self .proxies ,
1384
1384
)
1385
-
1385
+
1386
1386
response = requests .post (
1387
1387
endpoint ,
1388
1388
headers = self .get_json_headers (),
@@ -1408,13 +1408,13 @@ def stop_broadcast(self, broadcast_id):
1408
1408
raise RequestError ("OpenTok server error." , response .status_code )
1409
1409
1410
1410
def add_broadcast_stream (
1411
- self ,
1411
+ self ,
1412
1412
broadcast_id : str ,
1413
1413
stream_id : str ,
1414
1414
has_audio : bool = True ,
1415
- has_video : bool = True
1415
+ has_video : bool = True
1416
1416
) -> requests .Response :
1417
-
1417
+
1418
1418
"""
1419
1419
This method will add streams to the broadcast with addStream for new participant(choosing audio, video or both).
1420
1420
@@ -1462,7 +1462,7 @@ def add_broadcast_stream(
1462
1462
else :
1463
1463
raise RequestError ("OpenTok server error." , response .status_code )
1464
1464
1465
-
1465
+
1466
1466
def remove_broadcast_stream (self , broadcast_id : str , stream_id : str ) -> requests .Response :
1467
1467
"""
1468
1468
This method will remove streams from the broadcast with removeStream.
@@ -1616,8 +1616,8 @@ def _create_jwt_auth_header(self):
1616
1616
}
1617
1617
1618
1618
return jwt .encode (payload , self .api_secret , algorithm = "HS256" )
1619
-
1620
-
1619
+
1620
+
1621
1621
1622
1622
class OpenTok (Client ):
1623
1623
def __init__ (
@@ -1641,10 +1641,9 @@ def __init__(
1641
1641
app_version = app_version
1642
1642
)
1643
1643
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 :
1648
1647
1649
1648
"""
1650
1649
Mutes all streams in an OpenTok session.
@@ -1653,22 +1652,19 @@ def mute_all(self,
1653
1652
1654
1653
:param session_id The session ID
1655
1654
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.
1657
1656
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).
1661
1657
"""
1662
1658
1663
1659
options = {}
1664
1660
url = self .endpoints .get_mute_all_url (session_id )
1665
1661
1666
1662
try :
1667
1663
if excludedStreamIds :
1668
- options = {'active' : active , 'excludedStreams' : excludedStreamIds }
1664
+ options = {'active' : True , 'excludedStreams' : excludedStreamIds }
1669
1665
else :
1670
- options = {'active' : active , 'excludedStreams' : []}
1671
-
1666
+ options = {'active' : True , 'excludedStreams' : []}
1667
+
1672
1668
response = requests .post (url , headers = self .get_headers (), data = json .dumps (options ))
1673
1669
1674
1670
if response :
@@ -1684,20 +1680,18 @@ def mute_all(self,
1684
1680
("There was an error thrown by the OpenTok SDK, please check that your session_id {0} and excludedStreamIds (if exists) {1} are valid" ).format (
1685
1681
session_id , excludedStreamIds ))
1686
1682
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 :
1689
1685
"""
1690
1686
Disables the mute all streams in an OpenTok session.
1691
1687
1692
1688
: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).
1696
1689
"""
1697
1690
1691
+ options = {'active' : False }
1698
1692
url = self .endpoints .get_mute_all_url (session_id )
1699
1693
1700
- response = requests .post (url , headers = self .get_headers ())
1694
+ response = requests .post (url , headers = self .get_headers (), data = json . dumps ( options ) )
1701
1695
1702
1696
1703
1697
try :
@@ -1713,7 +1707,7 @@ def disable_force_mute(self, session_id: str, active: bool= False) -> requests.R
1713
1707
raise OpenTokException (
1714
1708
("There was an error thrown by the OpenTok SDK, please check that your session_id {0} is valid" ).format (
1715
1709
session_id ))
1716
-
1710
+
1717
1711
1718
1712
def mute_stream (self , session_id : str , stream_id : str ) -> requests .Response :
1719
1713
"""
@@ -1781,4 +1775,3 @@ def play_dtmf(self, session_id: str, connection_id: str, digits: str, options: d
1781
1775
except Exception as e :
1782
1776
raise OpenTokException (
1783
1777
(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