Skip to content

Commit 6f2940f

Browse files
committed
Generated reference docs.
1 parent ccc3eb0 commit 6f2940f

File tree

6 files changed

+170
-49
lines changed

6 files changed

+170
-49
lines changed

docs/README.html

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ <h3>Navigation</h3>
3232
<li class="right" style="margin-right: 10px">
3333
<a href="genindex.html" title="General Index"
3434
accesskey="I">index</a></li>
35-
<li class="right" >
36-
<a href="py-modindex.html" title="Python Module Index"
37-
>modules</a> |</li>
3835
<li><a href="index.html">OpenTok Python SDK 2.2 2.2.0 documentation</a> &raquo;</li>
3936
</ul>
4037
</div>
@@ -50,8 +47,7 @@ <h1>OpenTok Python SDK<a class="headerlink" href="#opentok-python-sdk" title="Pe
5047
<p>The OpenTok Python SDK lets you generate
5148
<a class="reference external" href="http://tokbox.com/opentok/tutorials/create-session/">sessions</a> and
5249
<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>
50+
applications, and <a class="reference external" href="http://www.tokbox.com/platform/archiving">archive</a> OpenTok sessions.</p>
5551
<div class="section" id="installation-using-pip-recommended">
5652
<h2>Installation using Pip (recommended):<a class="headerlink" href="#installation-using-pip-recommended" title="Permalink to this headline"></a></h2>
5753
<p>Pip helps manage dependencies for Python projects using the PyPI index. Find more info here:
@@ -80,16 +76,19 @@ <h3>Initializing<a class="headerlink" href="#initializing" title="Permalink to t
8076
</div>
8177
<div class="section" id="creating-sessions">
8278
<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
79+
<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
8480
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>
81+
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
82+
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>).
83+
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
84+
store (such as a database).</p>
8885
<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>
8986
<span class="c"># to use the OpenTok TURN server to relay streams if the clients cannot connect):</span>
9087
<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>
9188
<span class="c"># A session that uses the OpenTok Media Router:</span>
9289
<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>
90+
<span class="c"># An automatically archived session:</span>
91+
<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>
9392
<span class="c"># A session with a location hint</span>
9493
<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>
9594

@@ -129,9 +128,18 @@ <h3>Working with Archives<a class="headerlink" href="#working-with-archives" tit
129128
<span class="n">archive_id</span> <span class="o">=</span> <span class="n">archive</span><span class="o">.</span><span class="n">id</span>
130129
</pre></div>
131130
</div>
132-
<p>You can also disable audio or video recording by setting the <cite>hasAudio</cite> or <cite>hasVideo</cite> property of
131+
<p>You can also disable audio or video recording by setting the <cite>has_audio</cite> or <cite>has_video</cite> property of
133132
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>
133+
<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>
134+
135+
<span class="c"># Store this archive_id in the database</span>
136+
<span class="n">archive_id</span> <span class="o">=</span> <span class="n">archive</span><span class="o">.</span><span class="n">id</span>
137+
</pre></div>
138+
</div>
139+
<p>By default, all streams are recorded to a single (composed) file. You can record the different
140+
streams in the session to individual files (instead of a single composed file) by setting the
141+
<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>
142+
<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>
135143

136144
<span class="c"># Store this archive_id in the database</span>
137145
<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 +184,11 @@ <h3>Working with Archives<a class="headerlink" href="#working-with-archives" tit
176184
<span class="n">total</span> <span class="o">=</span> <span class="n">archive_list</span><span class="o">.</span><span class="n">total</span>
177185
</pre></div>
178186
</div>
187+
<p>Note that you can also create an automatically archived session, by passing in
188+
<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
189+
<tt class="docutils literal"><span class="pre">opentok.create_session()</span></tt> method (see &#8220;Creating Sessions,&#8221; above).</p>
190+
<p>For more information on archiving, see the
191+
<a class="reference external" href="https://tokbox.com/opentok/tutorials/archiving/">OpenTok archiving</a> programming guide.</p>
179192
</div>
180193
</div>
181194
<div class="section" id="samples">
@@ -211,8 +224,7 @@ <h2>Important changes since v2.2<a class="headerlink" href="#important-changes-s
211224
between each other (peer-to-peer); if clients cannot connect due to firewall restrictions, the
212225
session uses the OpenTok TURN server to relay audio-video streams.</p>
213226
<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>
227+
<p>This version of the SDK includes support for working with OpenTok archives.</p>
216228
<p>The OpenTok.create_session() method now includes a media_mode parameter, instead of a p2p parameter.</p>
217229
<p>For details, see the reference documentation at
218230
&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>
@@ -286,9 +298,6 @@ <h3>Navigation</h3>
286298
<li class="right" style="margin-right: 10px">
287299
<a href="genindex.html" title="General Index"
288300
>index</a></li>
289-
<li class="right" >
290-
<a href="py-modindex.html" title="Python Module Index"
291-
>modules</a> |</li>
292301
<li><a href="index.html">OpenTok Python SDK 2.2 2.2.0 documentation</a> &raquo;</li>
293302
</ul>
294303
</div>

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)