Skip to content

Commit 1a14549

Browse files
committed
added preliminary docs
1 parent a583f13 commit 1a14549

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

README.rst

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,20 @@ Import the package at the top of any file where you will use it. At the very lea
4646
Creating Sessions
4747
~~~~~~~~~~~~~~~~~
4848

49-
The create an OpenTok Session, use the ``opentok.create_session()`` method. There are two optional
49+
The create an OpenTok Session, use the ``opentok.create_session()`` method. There are three optional
5050
keyword parameters for this method: ``location`` which can be set to a string containing an IP
51-
address, and ``media_mode`` which is a String (defined by the MediaModes class). This method returns
52-
a ``Session`` object. Its ``session_id`` attribute is useful when saving to a persistent store (such
53-
as a database).
51+
address, ``media_mode`` which is a String (defined by the MediaModes class) and ``archive_mode`` which
52+
specifies whether the session will be automatically archived (``always``) or not (``manual``).
53+
This method returns a ``Session`` object. Its ``session_id`` attribute is useful when saving to a persistent
54+
store (such as a database).
5455

5556
.. code:: python
5657
5758
# Create a session that attempts to send streams directly between clients (falling back
5859
# to use the OpenTok TURN server to relay streams if the clients cannot connect):
5960
session = opentok.create_session()
6061
# A session that uses the OpenTok Media Router:
61-
session = opentok.create_session(media_mode=MediaModes.routed)
62+
session = opentok.create_session(media_mode=MediaModes.routed, archive_mode=ArchiveModes.always)
6263
# A session with a location hint
6364
session = opentok.create_session(location=u'12.34.56.78')
6465
@@ -101,12 +102,23 @@ a Session that has clients connection.
101102
# Store this archive_id in the database
102103
archive_id = archive.id
103104
104-
You can also disable audio or video recording by setting the `hasAudio` or `hasVideo` property of
105+
You can also disable audio or video recording by setting the `has_audio` or `has_video` property of
105106
the `options` parameter to `false`:
106107

107108
.. code:: python
108109
109-
archive = opentok.start_archive(session_id, name=u'Important Presentation', hasVideo=False)
110+
archive = opentok.start_archive(session_id, name=u'Important Presentation', has_video=False)
111+
112+
# Store this archive_id in the database
113+
archive_id = archive.id
114+
115+
By default, all streams are recorded to a single (composed) file. You can record the different
116+
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`.
118+
119+
.. code:: python
120+
121+
archive = opentok.start_archive(session_id, name=u'Important Presentation', output_mode=OutputModes.individual)
110122
111123
# Store this archive_id in the database
112124
archive_id = archive.id
@@ -158,6 +170,10 @@ instance of the ``ArchiveList`` class.
158170
# Get the total number of Archives for this API Key
159171
total = archive_list.total
160172
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).
176+
161177
Samples
162178
-------
163179

0 commit comments

Comments
 (0)