@@ -19,7 +19,7 @@ http://www.pip-installer.org/en/latest/
19
19
Add the ``opentok `` package as a dependency in your project. The most common way is to add it to your
20
20
``requirements.txt `` file::
21
21
22
- opentok>=2.4.1
22
+ opentok>=2.5.0
23
23
24
24
Next, install the dependencies::
25
25
@@ -44,10 +44,20 @@ Import the package at the top of any file where you will use it. At the very lea
44
44
Creating Sessions
45
45
~~~~~~~~~~~~~~~~~
46
46
47
- The create an OpenTok Session, use the ``opentok.create_session() `` method. There are three optional
48
- keyword parameters for this method: ``location `` which can be set to a string containing an IP
49
- address, ``media_mode `` which is a String (defined by the MediaModes class) and ``archive_mode `` which
50
- specifies whether the session will be automatically archived (``always ``) or not (``manual ``).
47
+ To create an OpenTok Session, use the ``opentok.create_session() `` method. There are three optional
48
+ keyword parameters for this method:
49
+
50
+ * ``location `` which can be set to a string containing an IP address.
51
+
52
+ * ``media_mode `` which is a String (defined by the MediaModes class).
53
+ This determines whether the session will use the
54
+ `OpenTok Media Router <https://tokbox.com/developer/guides/create-session/#media-mode >`_
55
+ or attempt to send streams directly between clients. A routed session is required for some
56
+ OpenTok features (such as archiving).
57
+
58
+ * ``archive_mode `` which specifies whether the session will be automatically archived (``always ``)
59
+ or not (``manual ``).
60
+
51
61
This method returns a ``Session `` object. Its ``session_id `` attribute is useful when saving to a persistent
52
62
store (such as a database).
53
63
@@ -58,7 +68,7 @@ store (such as a database).
58
68
session = opentok.create_session()
59
69
60
70
from opentok import MediaModes
61
- # A session that uses the OpenTok Media Router:
71
+ # A session that uses the OpenTok Media Router, which is required for archiving :
62
72
session = opentok.create_session(media_mode = MediaModes.routed)
63
73
64
74
# An automatically archived session:
@@ -75,8 +85,9 @@ Generating Tokens
75
85
76
86
Once a Session is created, you can start generating Tokens for clients to use when connecting to it.
77
87
You can generate a token either by calling the ``opentok.generate_token(session_id) `` method or by
78
- calling the ``session.generate_token() `` method on a ``Session `` instance after creating it. There
79
- is a set of optional keyword parameters: ``role ``, ``expire_time ``, and ``data ``.
88
+ calling the ``session.generate_token() `` method on a ``Session `` instance after creating it. Both
89
+ have a set of optional keyword parameters: ``role ``, ``expire_time ``, ``data ``, and
90
+ ``initial_layout_class_list ``.
80
91
81
92
.. code :: python
82
93
@@ -89,15 +100,19 @@ is a set of optional keyword parameters: ``role``, ``expire_time``, and ``data``
89
100
# Set some options in a token
90
101
token = session.generate_token(role = Roles.moderator,
91
102
expire_time = int (time.time()) + 10 ,
92
- data = u ' name=Johnny' )
103
+ data = u ' name=Johnny'
104
+ initial_layout_class_list = [u ' focus' ])
93
105
94
106
Working with Archives
95
107
~~~~~~~~~~~~~~~~~~~~~
96
108
109
+ You can only archive sessions that use the OpenTok Media
110
+ Router (sessions with the media mode set to routed).
111
+
97
112
You can start the recording of an OpenTok Session using the ``opentok.start_archive(session_id) ``
98
113
method. This method takes an optional keyword argument ``name `` to assign a name to the archive.
99
114
This method will return an ``Archive `` instance. Note that you can only start an Archive on
100
- a Session that has clients connection .
115
+ a Session that has clients connected .
101
116
102
117
.. code :: python
103
118
@@ -194,15 +209,14 @@ repository and follow the Walkthroughs:
194
209
Documentation
195
210
-------------
196
211
197
- Reference documentation is available at <http://www.tokbox.com/opentok/libraries/server/python/reference/index.html> and in the
198
- docs directory of the SDK.
212
+ Reference documentation is available at <http://www.tokbox.com/opentok/libraries/server/python/reference/index.html>.
199
213
200
214
Requirements
201
215
------------
202
216
203
217
You need an OpenTok API key and API secret, which you can obtain at https://dashboard.tokbox.com/
204
218
205
- The OpenTok Python SDK requires Python 2.6, 2.7, 3.2 , 3.3, or 3.4
219
+ The OpenTok Python SDK requires Python 2.6, 2.7, 3.3 , 3.4, 3.5 or 3.6
206
220
207
221
Release Notes
208
222
-------------
0 commit comments