Skip to content

Commit f997235

Browse files
committed
Merge pull request #67 from jeffswartz/archiving_updates_docs
Archiving updates docs
2 parents fe389cf + e5fae34 commit f997235

File tree

11 files changed

+233
-94
lines changed

11 files changed

+233
-94
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

docs/README.html

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ <h1>OpenTok Python SDK<a class="headerlink" href="#opentok-python-sdk" title="Pe
5050
<p>The OpenTok Python SDK lets you generate
5151
<a class="reference external" href="http://tokbox.com/opentok/tutorials/create-session/">sessions</a> and
5252
<a class="reference external" href="http://tokbox.com/opentok/tutorials/create-token/">tokens</a> for <a class="reference external" href="http://www.tokbox.com/">OpenTok</a>
53-
applications, and <a class="reference external" href="https://tokbox.com/opentok/tutorials/archiving">archive</a> OpenTok sessions.</p>
54-
<p>If you are updating from a previous version of this SDK, see &#8220;Important changes since v2.2.0&#8221; below.</p>
53+
applications, and <a class="reference external" href="http://www.tokbox.com/platform/archiving">archive</a> OpenTok sessions.</p>
5554
<div class="section" id="installation-using-pip-recommended">
5655
<h2>Installation using Pip (recommended):<a class="headerlink" href="#installation-using-pip-recommended" title="Permalink to this headline"></a></h2>
5756
<p>Pip helps manage dependencies for Python projects using the PyPI index. Find more info here:
@@ -80,16 +79,19 @@ <h3>Initializing<a class="headerlink" href="#initializing" title="Permalink to t
8079
</div>
8180
<div class="section" id="creating-sessions">
8281
<h3>Creating Sessions<a class="headerlink" href="#creating-sessions" title="Permalink to this headline"></a></h3>
83-
<p>The create an OpenTok Session, use the <tt class="docutils literal"><span class="pre">opentok.create_session()</span></tt> method. There are two optional
82+
<p>The create an OpenTok Session, use the <tt class="docutils literal"><span class="pre">opentok.create_session()</span></tt> method. There are three optional
8483
keyword parameters for this method: <tt class="docutils literal"><span class="pre">location</span></tt> which can be set to a string containing an IP
85-
address, and <tt class="docutils literal"><span class="pre">media_mode</span></tt> which is a String (defined by the MediaModes class). This method returns
86-
a <tt class="docutils literal"><span class="pre">Session</span></tt> object. Its <tt class="docutils literal"><span class="pre">session_id</span></tt> attribute is useful when saving to a persistent store (such
87-
as a database).</p>
84+
address, <tt class="docutils literal"><span class="pre">media_mode</span></tt> which is a String (defined by the MediaModes class) and <tt class="docutils literal"><span class="pre">archive_mode</span></tt> which
85+
specifies whether the session will be automatically archived (<tt class="docutils literal"><span class="pre">always</span></tt>) or not (<tt class="docutils literal"><span class="pre">manual</span></tt>).
86+
This method returns a <tt class="docutils literal"><span class="pre">Session</span></tt> object. Its <tt class="docutils literal"><span class="pre">session_id</span></tt> attribute is useful when saving to a persistent
87+
store (such as a database).</p>
8888
<div class="code python highlight-python"><div class="highlight"><pre><span class="c"># Create a session that attempts to send streams directly between clients (falling back</span>
8989
<span class="c"># to use the OpenTok TURN server to relay streams if the clients cannot connect):</span>
9090
<span class="n">session</span> <span class="o">=</span> <span class="n">opentok</span><span class="o">.</span><span class="n">create_session</span><span class="p">()</span>
9191
<span class="c"># A session that uses the OpenTok Media Router:</span>
9292
<span class="n">session</span> <span class="o">=</span> <span class="n">opentok</span><span class="o">.</span><span class="n">create_session</span><span class="p">(</span><span class="n">media_mode</span><span class="o">=</span><span class="n">MediaModes</span><span class="o">.</span><span class="n">routed</span><span class="p">)</span>
93+
<span class="c"># An automatically archived session:</span>
94+
<span class="n">session</span> <span class="o">=</span> <span class="n">opentok</span><span class="o">.</span><span class="n">create_session</span><span class="p">(</span><span class="n">media_mode</span><span class="o">=</span><span class="n">MediaModes</span><span class="o">.</span><span class="n">routed</span><span class="p">,</span> <span class="n">archive_mode</span><span class="o">=</span><span class="n">ArchiveModes</span><span class="o">.</span><span class="n">always</span><span class="p">)</span>
9395
<span class="c"># A session with a location hint</span>
9496
<span class="n">session</span> <span class="o">=</span> <span class="n">opentok</span><span class="o">.</span><span class="n">create_session</span><span class="p">(</span><span class="n">location</span><span class="o">=</span><span class="s">u&#39;12.34.56.78&#39;</span><span class="p">)</span>
9597

@@ -129,9 +131,18 @@ <h3>Working with Archives<a class="headerlink" href="#working-with-archives" tit
129131
<span class="n">archive_id</span> <span class="o">=</span> <span class="n">archive</span><span class="o">.</span><span class="n">id</span>
130132
</pre></div>
131133
</div>
132-
<p>You can also disable audio or video recording by setting the <cite>hasAudio</cite> or <cite>hasVideo</cite> property of
134+
<p>You can also disable audio or video recording by setting the <cite>has_audio</cite> or <cite>has_video</cite> property of
133135
the <cite>options</cite> parameter to <cite>false</cite>:</p>
134-
<div class="code python highlight-python"><div class="highlight"><pre><span class="n">archive</span> <span class="o">=</span> <span class="n">opentok</span><span class="o">.</span><span class="n">start_archive</span><span class="p">(</span><span class="n">session_id</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s">u&#39;Important Presentation&#39;</span><span class="p">,</span> <span class="n">hasVideo</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span>
136+
<div class="code python highlight-python"><div class="highlight"><pre><span class="n">archive</span> <span class="o">=</span> <span class="n">opentok</span><span class="o">.</span><span class="n">start_archive</span><span class="p">(</span><span class="n">session_id</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s">u&#39;Important Presentation&#39;</span><span class="p">,</span> <span class="n">has_video</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span>
137+
138+
<span class="c"># Store this archive_id in the database</span>
139+
<span class="n">archive_id</span> <span class="o">=</span> <span class="n">archive</span><span class="o">.</span><span class="n">id</span>
140+
</pre></div>
141+
</div>
142+
<p>By default, all streams are recorded to a single (composed) file. You can record the different
143+
streams in the session to individual files (instead of a single composed file) by setting the
144+
<tt class="docutils literal"><span class="pre">output_mode</span></tt> parameter of the <tt class="docutils literal"><span class="pre">opentok.start_archive()</span></tt> method <cite>OutputModes.individual</cite>.</p>
145+
<div class="code python highlight-python"><div class="highlight"><pre><span class="n">archive</span> <span class="o">=</span> <span class="n">opentok</span><span class="o">.</span><span class="n">start_archive</span><span class="p">(</span><span class="n">session_id</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s">u&#39;Important Presentation&#39;</span><span class="p">,</span> <span class="n">output_mode</span><span class="o">=</span><span class="n">OutputModes</span><span class="o">.</span><span class="n">individual</span><span class="p">)</span>
135146

136147
<span class="c"># Store this archive_id in the database</span>
137148
<span class="n">archive_id</span> <span class="o">=</span> <span class="n">archive</span><span class="o">.</span><span class="n">id</span>
@@ -176,6 +187,11 @@ <h3>Working with Archives<a class="headerlink" href="#working-with-archives" tit
176187
<span class="n">total</span> <span class="o">=</span> <span class="n">archive_list</span><span class="o">.</span><span class="n">total</span>
177188
</pre></div>
178189
</div>
190+
<p>Note that you can also create an automatically archived session, by passing in
191+
<tt class="docutils literal"><span class="pre">ArchiveModes.always</span></tt> as the <tt class="docutils literal"><span class="pre">archive_mode</span></tt> parameter when you call the
192+
<tt class="docutils literal"><span class="pre">opentok.create_session()</span></tt> method (see &#8220;Creating Sessions,&#8221; above).</p>
193+
<p>For more information on archiving, see the
194+
<a class="reference external" href="https://tokbox.com/opentok/tutorials/archiving/">OpenTok archiving</a> programming guide.</p>
179195
</div>
180196
</div>
181197
<div class="section" id="samples">
@@ -211,8 +227,7 @@ <h2>Important changes since v2.2<a class="headerlink" href="#important-changes-s
211227
between each other (peer-to-peer); if clients cannot connect due to firewall restrictions, the
212228
session uses the OpenTok TURN server to relay audio-video streams.</p>
213229
<p><strong>Changes in v2.2.0:</strong></p>
214-
<p>This version of the SDK includes support for working with OpenTok 2.0 archives. (This API does not
215-
work with OpenTok 1.0 archives.)</p>
230+
<p>This version of the SDK includes support for working with OpenTok archives.</p>
216231
<p>The OpenTok.create_session() method now includes a media_mode parameter, instead of a p2p parameter.</p>
217232
<p>For details, see the reference documentation at
218233
&lt;<a class="reference external" href="http://www.tokbox.com/opentok/libraries/server/python/reference/index.html">http://www.tokbox.com/opentok/libraries/server/python/reference/index.html</a>&gt;.</p>

docs/_sources/README.txt

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ OpenTok Python SDK
88
The OpenTok Python SDK lets you generate
99
`sessions <http://tokbox.com/opentok/tutorials/create-session/>`_ and
1010
`tokens <http://tokbox.com/opentok/tutorials/create-token/>`_ for `OpenTok <http://www.tokbox.com/>`_
11-
applications, and `archive <https://tokbox.com/opentok/tutorials/archiving>`_ OpenTok sessions.
12-
13-
If you are updating from a previous version of this SDK, see "Important changes since v2.2.0" below.
11+
applications, and `archive <http://www.tokbox.com/platform/archiving>`_ OpenTok sessions.
1412

1513
Installation using Pip (recommended):
1614
-------------------------------------
@@ -46,11 +44,12 @@ Import the package at the top of any file where you will use it. At the very lea
4644
Creating Sessions
4745
~~~~~~~~~~~~~~~~~
4846

49-
The create an OpenTok Session, use the ``opentok.create_session()`` method. There are two optional
47+
The create an OpenTok Session, use the ``opentok.create_session()`` method. There are three optional
5048
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).
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``).
51+
This method returns a ``Session`` object. Its ``session_id`` attribute is useful when saving to a persistent
52+
store (such as a database).
5453

5554
.. code:: python
5655

@@ -59,6 +58,8 @@ as a database).
5958
session = opentok.create_session()
6059
# A session that uses the OpenTok Media Router:
6160
session = opentok.create_session(media_mode=MediaModes.routed)
61+
# An automatically archived session:
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 `OutputModes.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,14 @@ 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
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+
180+
161181
Samples
162182
-------
163183

@@ -199,8 +219,7 @@ session uses the OpenTok TURN server to relay audio-video streams.
199219

200220
**Changes in v2.2.0:**
201221

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

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

0 commit comments

Comments
 (0)