Skip to content

Commit ccc3eb0

Browse files
committed
Docs edits.
1 parent fe389cf commit ccc3eb0

File tree

4 files changed

+59
-47
lines changed

4 files changed

+59
-47
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,6 @@ docs/_build/
4343

4444
# Virtual env
4545
venv/
46+
47+
# Mac Desktop files
48+
.DS_Store

README.rst

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ The OpenTok Python SDK lets you generate
1010
`tokens <http://tokbox.com/opentok/tutorials/create-token/>`_ for `OpenTok <http://www.tokbox.com/>`_
1111
applications, and `archive <http://www.tokbox.com/platform/archiving>`_ OpenTok sessions.
1212

13-
If you are updating from a previous version of this SDK, see "Important changes since v2.2.0" below.
14-
1513
Installation using Pip (recommended):
1614
-------------------------------------
1715

@@ -59,6 +57,8 @@ store (such as a database).
5957
# to use the OpenTok TURN server to relay streams if the clients cannot connect):
6058
session = opentok.create_session()
6159
# A session that uses the OpenTok Media Router:
60+
session = opentok.create_session(media_mode=MediaModes.routed)
61+
# An automatically archived session:
6262
session = opentok.create_session(media_mode=MediaModes.routed, archive_mode=ArchiveModes.always)
6363
# A session with a location hint
6464
session = opentok.create_session(location=u'12.34.56.78')
@@ -114,7 +114,7 @@ the `options` parameter to `false`:
114114
115115
By default, all streams are recorded to a single (composed) file. You can record the different
116116
streams in the session to individual files (instead of a single composed file) by setting the
117-
``output_mode`` parameter of the ``opentok.start_archive()`` method `OutputModesModes.individual`.
117+
``output_mode`` parameter of the ``opentok.start_archive()`` method `OutputModes.individual`.
118118

119119
.. code:: python
120120
@@ -170,9 +170,13 @@ instance of the ``ArchiveList`` class.
170170
# Get the total number of Archives for this API Key
171171
total = archive_list.total
172172
173-
Note that you can also create an automatically archived session, by passing in ``ArchiveModes.always``
174-
as the ``archive_mode`` parameter when you call the ``opentok.create_session()`` method (see "Creating
175-
Sessions," above).
173+
Note that you can also create an automatically archived session, by passing in
174+
``ArchiveModes.always`` as the ``archive_mode`` parameter when you call the
175+
``opentok.create_session()`` method (see "Creating Sessions," above).
176+
177+
For more information on archiving, see the
178+
`OpenTok archiving <https://tokbox.com/opentok/tutorials/archiving/>`_ programming guide.
179+
176180

177181
Samples
178182
-------
@@ -215,8 +219,7 @@ session uses the OpenTok TURN server to relay audio-video streams.
215219

216220
**Changes in v2.2.0:**
217221

218-
This version of the SDK includes support for working with OpenTok 2.0 archives. (This API does not
219-
work with OpenTok 1.0 archives.)
222+
This version of the SDK includes support for working with OpenTok archives.
220223

221224
The OpenTok.create_session() method now includes a media_mode parameter, instead of a p2p parameter.
222225

opentok/archives.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
dthandler = lambda obj: obj.isoformat() if isinstance(obj, datetime) or isinstance(obj, date) else None
1313

1414
class OutputModes(Enum):
15-
"""List of valid settings for the outputMode parameter of the OpenTok.start_archive() method."""
15+
"""List of valid settings for the output_mode parameter of the OpenTok.start_archive()
16+
method."""
1617
composed = u('composed')
17-
"""The archive will produce a single MP4 file composed of all streams."""
18+
"""All streams in the archive are recorded to a single (composed) file."""
1819
individual = u('individual')
19-
"""The archive will generate a ZIP container with multiple individual WEBM files and a JSON metadata
20-
file for video synchronization."""
20+
"""Each stream in the archive is recorded to an individual file."""
2121

2222
class Archive(object):
2323
"""Represents an archive of an OpenTok session.
@@ -28,27 +28,25 @@ class Archive(object):
2828
:ivar duration:
2929
The duration of the archive, in milliseconds.
3030
31-
:ivar hasAudio:
31+
:ivar has_audio:
3232
Boolean value set to true when the archive contains an audio track,
3333
and set to false otherwise.
3434
35-
:ivar hasVideo:
35+
:ivar has_video:
3636
Boolean value set to true when the archive contains a video track,
3737
and set to false otherwise.
3838
39-
:ivar outputMode:
40-
The output mode to be generated for this archive:
41-
The default value is composed (a single MP4 file composed of all streams).
42-
Value individual will generate a ZIP container with multiple individual WEBM files
43-
and a JSON metadata file for video synchronization.
44-
4539
:ivar id:
4640
The archive ID.
4741
4842
:ivar name:
4943
The name of the archive. If no name was provided when the archive was created, this is set
5044
to null.
5145
46+
:ivar output_mode:
47+
Whether all streams in the archive are recorded to a single file
48+
(OutputModes.composed) or to individual files (OutputModes.individual).
49+
5250
:ivar partnerId:
5351
The API key associated with the archive.
5452
@@ -69,7 +67,12 @@ class Archive(object):
6967
* "available" -- The archive is available for download from the OpenTok cloud.
7068
* "expired" -- The archive is no longer available for download from the OpenTok cloud.
7169
* "failed" -- The archive recording failed.
72-
* "paused" -- The archive recording has paused.
70+
* "paused" -- The archive is in progress and no clients are publishing streams to the
71+
session. When an archive is in progress and any client publishes a stream, the status is
72+
"started". When an archive is paused, nothing is recorded. When a client starts publishing
73+
a stream, the recording starts (or resumes). If all clients disconnect from a session that
74+
is being archived, the status changes to "paused", and after 60 seconds the archive
75+
recording stops (and the status changes to "stopped").
7376
* "started" -- The archive started and is in the process of being recorded.
7477
* "stopped" -- The archive stopped recording.
7578
* "uploaded" -- The archive is available for download from the the upload target

opentok/opentok.py

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ class MediaModes(Enum):
4242
their streams will be relayed using the OpenTok TURN Server."""
4343

4444
class ArchiveModes(Enum):
45-
"""List of valid settings for the archiveMode parameter of the OpenTok.createSession() method."""
45+
"""List of valid settings for the archive_mode parameter of the OpenTok.createSession()
46+
method."""
4647
manual = u('manual')
4748
"""The session will be manually archived."""
4849
always = u('always')
@@ -172,21 +173,21 @@ def create_session(self, location=None, media_mode=MediaModes.relayed, archive_m
172173
Calling this method results in an OpenTokException in the event of an error.
173174
Check the error message for details.
174175
175-
You can also create a session using the OpenTok REST API (see
176-
http://www.tokbox.com/opentok/api/#session_id_production) or the OpenTok dashboard
177-
(see https://dashboard.tokbox.com/projects).
176+
You can also create a session using the OpenTok
177+
`REST API <https://tokbox.com/opentok/api/#session_id_production>`_ or
178+
`the OpenTok dashboard <https://dashboard.tokbox.com/projects>`_.
178179
179-
:param String mediaMode: Determines whether the session will transmit streams using the
180+
:param String media_mode: Determines whether the session will transmit streams using the
180181
OpenTok Media Router (MediaMode.routed) or not (MediaMode.relayed). By default,
181182
the setting is MediaMode.relayed.
182183
183-
With the mediaMode property set to MediaMode.relayed, the session
184+
With the media_mode property set to MediaMode.relayed, the session
184185
will attempt to transmit streams directly between clients. If clients cannot connect
185186
due to firewall restrictions, the session uses the OpenTok TURN server to relay
186187
audio-video streams.
187188
188-
The OpenTok Media Router (see
189-
https://tokbox.com/opentok/tutorials/create-session/#media-mode)
189+
The `OpenTok Media
190+
Router <https://tokbox.com/opentok/tutorials/create-session/#media-mode>`_
190191
provides the following benefits:
191192
192193
* The OpenTok Media Router can decrease bandwidth usage in multiparty sessions.
@@ -203,12 +204,12 @@ def create_session(self, location=None, media_mode=MediaModes.relayed, archive_m
203204
* The OpenTok Media Router supports the archiving feature, which lets
204205
you record, save, and retrieve OpenTok sessions (see http://tokbox.com/platform/archiving).
205206
206-
:param String archiveMode: Whether the session is automatically archived
207-
(ArchiveMode.always) or not (ArchiveMode.manual). By default,
208-
the setting is ArchiveMode.manual, and you must call the
209-
start_archive() method of the OpenTok object to start archiving. To archive the session
210-
(either automatically or not), you must set the mediaMode parameter to
211-
MediaMode.routed.
207+
:param String archive_mode: Whether the session is automatically archived
208+
(ArchiveModes.always) or not (ArchiveModes.manual). By default,
209+
the setting is ArchiveModes.manual, and you must call the
210+
start_archive() method of the OpenTok object to start archiving. To archive the session
211+
(either automatically or not), you must set the media_mode parameter to
212+
MediaModes.routed.
212213
213214
:param String location: An IP address that the OpenTok servers will use to
214215
situate the session in its global network. If you do not set a location hint,
@@ -285,29 +286,31 @@ def archive_url(self, archive_id=None):
285286

286287
def start_archive(self, session_id, has_audio=True, has_video=True, name=None, output_mode=OutputModes.composed):
287288
"""
288-
Starts archiving an OpenTok 2.0 session.
289+
Starts archiving an OpenTok session.
289290
290291
Clients must be actively connected to the OpenTok session for you to successfully start
291292
recording an archive.
292293
293294
You can only record one archive at a time for a given session. You can only record archives
294-
of sessions that use the OpenTok Media Router (sessions witht the media mode set to routed);
295-
you cannot archive sessions witht the media mode set to relayed.
295+
of sessions that use the OpenTok Media Router (sessions with the media mode set to routed);
296+
you cannot archive sessions with the media mode set to relayed.
297+
298+
For more information on archiving, see the
299+
`OpenTok archiving <https://tokbox.com/opentok/tutorials/archiving/>`_ programming guide.
296300
297301
:param String session_id: The session ID of the OpenTok session to archive.
298302
:param String name: This is the name of the archive. You can use this name
299303
to identify the archive. It is a property of the Archive object, and it is a property
300304
of archive-related events in the OpenTok.js library.
301-
:param Boolean hasAudio: if set to True, an audio track will be inserted to the archive.
302-
hasAudio is an optional parameter that is set to True by default. If you set both
303-
hasAudio and hasVideo to False, the call to the start_archive() method results in
305+
:param Boolean has_audio: if set to True, an audio track will be inserted to the archive.
306+
has_audio is an optional parameter that is set to True by default. If you set both
307+
has_audio and has_video to False, the call to the start_archive() method results in
304308
an error.
305-
:param Boolean hasVideo: if set to True, a video track will be inserted to the archive.
306-
hasVideo is an optional parameter that is set to True by default.
307-
:param OutputModes outputMode: if set to composed, a single MP4 file composed of all streams
308-
will be generated. If you set it to individual it will create a ZIP container with multiple
309-
individual WEBM files and a JSON metadata file for video synchronization.
310-
outputMode is an optional parameter that is set to composed by default.
309+
:param Boolean has_video: if set to True, a video track will be inserted to the archive.
310+
has_video is an optional parameter that is set to True by default.
311+
:param OutputModes output_mode: Whether all streams in the archive are recorded
312+
to a single file (OutputModes.composed, the default) or to individual files
313+
(OutputModes.individual).
311314
312315
:rtype: The Archive object, which includes properties defining the archive,
313316
including the archive ID.

0 commit comments

Comments
 (0)