@@ -64,6 +64,9 @@ class Roles(Enum):
64
64
"""A subscriber can only subscribe to streams."""
65
65
publisher = u ("publisher" )
66
66
"""A publisher can publish streams, subscribe to streams, and signal"""
67
+ publisher_only = "publisheronly"
68
+ """A client with the `publisher_only` role can only publish streams. It cannot subscribe to
69
+ other clients' streams or send signals."""
67
70
moderator = u ("moderator" )
68
71
"""In addition to the privileges granted to a publisher, a moderator can perform
69
72
moderation functions, such as forcing clients to disconnect, to stop publishing streams,
@@ -106,7 +109,6 @@ class ArchiveModes(Enum):
106
109
107
110
108
111
class Client (object ):
109
-
110
112
"""Use this SDK to create tokens and interface with the server-side portion
111
113
of the Opentok API.
112
114
"""
@@ -187,6 +189,9 @@ def generate_token(
187
189
* `Roles.publisher` -- A publisher can publish streams, subscribe to
188
190
streams, and signal. (This is the default value if you do not specify a role.)
189
191
192
+ * `Roles.publisher_only` -- A client with the `publisher_only` role can only publish streams.
193
+ It cannot subscribe to other clients' streams or send signals.
194
+
190
195
* `Roles.moderator` -- In addition to the privileges granted to a
191
196
publisher, in clients using the OpenTok.js 2.2 library, a moderator can call the
192
197
`forceUnpublish()` and `forceDisconnect()` method of the
@@ -499,9 +504,7 @@ def create_session(
499
504
)
500
505
)
501
506
502
- session_id = (
503
- dom .getElementsByTagName ("session_id" )[0 ].childNodes [0 ].nodeValue
504
- )
507
+ session_id = dom .getElementsByTagName ("session_id" )[0 ].childNodes [0 ].nodeValue
505
508
return Session (
506
509
self ,
507
510
session_id ,
@@ -890,9 +893,7 @@ def add_archive_stream(
890
893
else :
891
894
raise RequestError ("An unexpected error occurred." , response .status_code )
892
895
893
- def remove_archive_stream (
894
- self , archive_id : str , stream_id : str
895
- ) -> requests .Response :
896
+ def remove_archive_stream (self , archive_id : str , stream_id : str ) -> requests .Response :
896
897
"""
897
898
This method will remove streams from the archive with removeStream.
898
899
@@ -1339,9 +1340,7 @@ class names (Strings) to apply to the stream. For example:
1339
1340
else :
1340
1341
raise RequestError ("OpenTok server error." , response .status_code )
1341
1342
1342
- def start_broadcast (
1343
- self , session_id , options , stream_mode = BroadcastStreamModes .auto
1344
- ):
1343
+ def start_broadcast (self , session_id , options , stream_mode = BroadcastStreamModes .auto ):
1345
1344
"""
1346
1345
Use this method to start a live streaming broadcast for an OpenTok session. This broadcasts
1347
1346
the session to an HLS (HTTP live streaming) or to RTMP streams. To successfully start
@@ -1576,9 +1575,7 @@ def add_broadcast_stream(
1576
1575
"Your broadcast is configured with a streamMode that does not support stream manipulation."
1577
1576
)
1578
1577
elif response .status_code == 409 :
1579
- raise BroadcastError (
1580
- "The broadcast has already started for the session."
1581
- )
1578
+ raise BroadcastError ("The broadcast has already started for the session." )
1582
1579
else :
1583
1580
raise RequestError ("An unexpected error occurred." , response .status_code )
1584
1581
@@ -1621,9 +1618,7 @@ def remove_broadcast_stream(
1621
1618
"Your broadcast is configured with a streamMode that does not support stream manipulation."
1622
1619
)
1623
1620
elif response .status_code == 409 :
1624
- raise BroadcastError (
1625
- "The broadcast has already started for the session."
1626
- )
1621
+ raise BroadcastError ("The broadcast has already started for the session." )
1627
1622
else :
1628
1623
raise RequestError ("OpenTok server error." , response .status_code )
1629
1624
0 commit comments