You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add the ``opentok`` package as a dependency in your project. The most common way is to add it to your
26
24
``requirements.txt`` file::
27
25
28
-
opentok>=2.10.0
26
+
opentok>=3.0
29
27
30
28
Next, install the dependencies::
31
29
@@ -39,13 +37,13 @@ Initializing
39
37
~~~~~~~~~~~~
40
38
41
39
Import the package at the top of any file where you will use it. At the very least you will need the
42
-
``OpenTok`` class. Then initialize an OpenTok instance with your own API Key and API Secret.
40
+
``Client`` class. Then initialize a Client instance with your own API Key and API Secret.
43
41
44
42
.. code:: python
45
43
46
-
from opentok importOpenTok
44
+
from opentok importClient
47
45
48
-
opentok =OpenTok(api_key, api_secret)
46
+
opentok =Client(api_key, api_secret)
49
47
50
48
Creating Sessions
51
49
~~~~~~~~~~~~~~~~~
@@ -238,7 +236,7 @@ For more information on archiving, see the
238
236
Sending Signals
239
237
~~~~~~~~~~~~~~~~~~~~~
240
238
241
-
Once a Session is created, you can send signals to everyone in the session or to a specific connection. You can send a signal by calling the ``signal(session_id, payload)`` method of the ``OpenTok`` class. The ``payload`` parameter is a dictionary used to set the ``type``, ``data`` fields. Ỳou can also call the method with the parameter ``connection_id`` to send a signal to a specific connection ``signal(session_id, data, connection_id)``.
239
+
Once a Session is created, you can send signals to everyone in the session or to a specific connection. You can send a signal by calling the ``signal(session_id, payload)`` method of the ``Client`` class. The ``payload`` parameter is a dictionary used to set the ``type``, ``data`` fields. Ỳou can also call the method with the parameter ``connection_id`` to send a signal to a specific connection ``signal(session_id, data, connection_id)``.
242
240
243
241
.. code:: python
244
242
@@ -259,7 +257,7 @@ Once a Session is created, you can send signals to everyone in the session or to
259
257
Working with Streams
260
258
~~~~~~~~~~~~~~~~~~~~~
261
259
262
-
You can get information about a stream by calling the `get_stream(session_id, stream_id)` method of the `OpenTok` class.
260
+
You can get information about a stream by calling the `get_stream(session_id, stream_id)` method of the `Client` class.
263
261
264
262
The method returns a Stream object that contains information of an OpenTok stream:
265
263
@@ -282,7 +280,7 @@ The method returns a Stream object that contains information of an OpenTok strea
282
280
print stream.name #stream name
283
281
print stream.layoutClassList #['full']
284
282
285
-
Also, you can get information about all the streams in a session by calling the `list_streams(session_id)` method of the `OpenTok` class.
283
+
Also, you can get information about all the streams in a session by calling the `list_streams(session_id)` method of the `Client` class.
286
284
287
285
The method returns a StreamList object that contains a list of all the streams
288
286
@@ -300,7 +298,7 @@ The method returns a StreamList object that contains a list of all the streams
300
298
print stream.name #stream name
301
299
print stream.layoutClassList #['full']
302
300
303
-
You can change the layout classes for streams in a session by calling the `set_stream_class_lists(session_id, stream_list)` method of the `OpenTok` class.
301
+
You can change the layout classes for streams in a session by calling the `set_stream_class_lists(session_id, stream_list)` method of the `Client` class.
304
302
305
303
The layout classes define how the stream is displayed in the layout of a composed OpenTok archive.
306
304
@@ -324,7 +322,7 @@ For more information see
324
322
Force Disconnect
325
323
~~~~~~~~~~~~~~~~~~~~~
326
324
327
-
Your application server can disconnect a client from an OpenTok session by calling the force_disconnect(session_id, connection_id) method of the OpenTok class, or the force_disconnect(connection_id) method of the Session class.
325
+
Your application server can disconnect a client from an OpenTok session by calling the force_disconnect(session_id, connection_id) method of the Client class, or the force_disconnect(connection_id) method of the Session class.
328
326
329
327
.. code:: python
330
328
@@ -472,14 +470,14 @@ For more information about OpenTok live streaming broadcasts, see the
472
470
473
471
474
472
Configuring Timeout
475
-
-------
476
-
Timeout is passed in the OpenTok constructor:
473
+
-------------------
474
+
Timeout is passed in the Client constructor:
477
475
478
476
``self.timeout = timeout``
479
477
480
478
In order to configure timeout, first create an instance:
481
479
482
-
``opentok = OpenTok(...., timeout=value)``
480
+
``opentok = Client(...., timeout=value)``
483
481
484
482
And then proceed to change the value with
485
483
@@ -504,7 +502,7 @@ Requirements
504
502
505
503
You need an OpenTok API key and API secret, which you can obtain at https://dashboard.tokbox.com/
506
504
507
-
The OpenTok Python SDK requires Python 2.6, 2.7, 3.3, 3.4, 3.5 or 3.6
505
+
The OpenTok Python SDK requires Python 3.5 or higher
508
506
509
507
Release Notes
510
508
-------------
@@ -527,7 +525,11 @@ session uses the OpenTok TURN server to relay audio-video streams.
527
525
528
526
This version of the SDK includes support for working with OpenTok archives.
529
527
530
-
The OpenTok.create_session() method now includes a media_mode parameter, instead of a p2p parameter.
528
+
The Client.create_session() method now includes a media_mode parameter, instead of a p2p parameter.
529
+
530
+
**Changes in v3.X.X:**
531
+
532
+
This version of the SDK includes significant improvements such as top level entity naming, where the Opentok class is now `Client`. We also implemented a standardised logging module, improved naming conventions and JWT generation to make developer experience more rewarding.
0 commit comments