Skip to content

Commit c2c632d

Browse files
committed
added supported resolutions to readme and documented previously undocumented methods
1 parent 719ac15 commit c2c632d

File tree

1 file changed

+91
-8
lines changed

1 file changed

+91
-8
lines changed

README.rst

Lines changed: 91 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,35 @@ streams in the session to individual files (instead of a single composed file) b
146146
# Store this archive_id in the database
147147
archive_id = archive.id
148148
149+
To add an individual stream to an archive, use the
150+
``opentok.add_archive_stream(archive_id, stream_id, has_audio, has_video)`` method:
151+
152+
.. code:: python
153+
154+
opentok.add_archive_stream(archive.id, stream_id, has_audio=True, has_video=True)
155+
156+
To remove a stream from an archive, use the ``opentok.remove_archive_stream()`` method:
157+
158+
.. code:: python
159+
160+
opentok.remove_archive_stream(archive.id, stream_id)
161+
149162
Composed archives (output_mode=OutputModes.composed) have an optional ``resolution`` parameter.
150-
If no value is supplied the opentok platform will use the default resolution "640x480".
151-
You can set this to "1280x720" by setting the
163+
If no value is supplied, the archive will use the default resolution, "640x480".
164+
You can set this to another resolution by setting the
152165
``resolution`` parameter of the ``opentok.start_archive()`` method.
153166

154-
Warning: This value cannot be set for Individual output mode, an error will be thrown.
167+
You can specify the following archive resolutions:
168+
169+
* "640x480" (SD landscape, default resolution)
170+
* "480x640" (SD portrait)
171+
* "1280x720" (HD landscape)
172+
* "720x1280" (HD portrait)
173+
* "1920x1080" (FHD landscape)
174+
* "1080x1920" (FHD portrait)
175+
176+
Setting the ``resolution`` parameter while setting the ``output_mode`` parameter to
177+
``OutputModes.individual`` results in an error.
155178

156179
.. code:: python
157180
@@ -160,7 +183,7 @@ Warning: This value cannot be set for Individual output mode, an error will be t
160183
# Store this archive_id in the database
161184
archive_id = archive.id
162185
163-
You can stop the recording of a started Archive using the ``opentok.stop_archive(archive_id)``
186+
To stop the recording of a started archive, call the ``opentok.stop_archive(archive_id)``
164187
method. You can also do this using the ``archive.stop()`` method of an ``Archive`` instance.
165188

166189
.. code:: python
@@ -195,7 +218,7 @@ filter by session ID. This method returns an instance of the ``ArchiveList`` cla
195218

196219
.. code:: python
197220
198-
archive_list = opentok.list_archive()
221+
archive_list = opentok.list_archives()
199222
200223
# Get a specific Archive from the list
201224
archive = archive_list.items[i]
@@ -371,7 +394,8 @@ Working with Broadcasts
371394

372395
OpenTok broadcast lets you share live OpenTok sessions with many viewers.
373396

374-
You can use the ``opentok.start_broadcast()`` method to start a live streaming for an OpenTok session. This broadcasts the session to an HLS (HTTP live streaming) or to RTMP streams.
397+
You can use the ``opentok.start_broadcast()`` method to start a live stream for an OpenTok session.
398+
This broadcasts the session to HLS (HTTP live streaming) or to RTMP streams.
375399

376400
To successfully start broadcasting a session, at least one client must be connected to the session.
377401

@@ -403,6 +427,15 @@ The live streaming broadcast can target one HLS endpoint and up to five RTMP ser
403427
404428
broadcast = opentok.start_broadcast(session_id, options)
405429
430+
You can specify the following broadcast resolutions:
431+
432+
* "640x480" (SD landscape, default resolution)
433+
* "480x640" (SD portrait)
434+
* "1280x720" (HD landscape)
435+
* "720x1280" (HD portrait)
436+
* "1920x1080" (FHD landscape)
437+
* "1080x1920" (FHD portrait)
438+
406439
You can stop a started Broadcast using the ``opentok.stop_broadcast(broadcast_id)`` method.
407440

408441
.. code:: python
@@ -465,6 +498,16 @@ You can dynamically change the layout type of a live streaming broadcast.
465498
'stream.instructor {position: absolute; width: 100%; height:50%;}'
466499
)
467500
501+
You can add streams to a broadcast using the ``opentok.add_broadcast_stream()`` method:
502+
503+
.. code:: python
504+
opentok.add_broadcast_stream(broadcast_id, stream_id)
505+
506+
Conversely, streams can be removed from a broadcast with the ``opentok.remove_broadcast_stream()`` method.
507+
508+
.. code:: python
509+
opentok.remove_broadcast_stream(broadcast_id, stream_id)
510+
468511
For more information about OpenTok live streaming broadcasts, see the
469512
`Broadcast developer guide <https://tokbox.com/developer/guides/broadcast/>`_.
470513

@@ -483,6 +526,46 @@ And then proceed to change the value with
483526

484527
``opentok.timeout = value``
485528

529+
Muting streams
530+
--------------
531+
532+
You can mute all streams in a session using the ``opentok.mute_all()`` method:
533+
534+
.. code:: python
535+
opentok.mute_all(session_id)
536+
537+
# You can also specify streams to exclude (e.g. main presenter)
538+
excluded_stream_ids = ['1234', '5678']
539+
opentok.mute_all(session_id, excluded_stream_ids)
540+
541+
In addition to existing streams, any streams that are published after the call to
542+
this method are published with audio muted. You can remove the mute state of a session
543+
by calling the ``opentok.disableForceMute()`` method:
544+
545+
.. code:: python
546+
opentok.disable_force_mute(session_id)
547+
548+
After calling the ``opentok.disableForceMute()`` method, new streams that are published
549+
to the session will not be muted.
550+
551+
You can mute a single stream using the ``opentok.mute_stream()`` method:
552+
553+
.. code:: python
554+
opentok.mute_stream(session_id, stream_id)
555+
556+
DTMF
557+
------
558+
559+
You can send dual-tone multi-frequency (DTMF) digits to SIP endpoints. You can play DTMF tones
560+
to all clients connected to session or to a specific connection:
561+
562+
.. code:: python
563+
digits = '12345'
564+
opentok.play_dtmf(session_id, digits)
565+
566+
# To a specific connection
567+
opentok.play_dtmf(session_id, connection_id, digits)
568+
486569
Samples
487570
-------
488571

@@ -495,7 +578,7 @@ repository and follow the Walkthroughs:
495578
Documentation
496579
-------------
497580

498-
Reference documentation is available at http://www.tokbox.com/opentok/libraries/server/python/reference/index.html.
581+
Reference documentation is available at https://tokbox.com/developer/sdks/python/reference/.
499582

500583
Requirements
501584
------------
@@ -532,7 +615,7 @@ The Client.create_session() method now includes a media_mode parameter, instead
532615
This version of the SDK includes significant improvements such as top level entity naming, where the Opentok class is now `Client`. We also implemented a standardised logging module, improved naming conventions and JWT generation to make developer experience more rewarding.
533616

534617
For details, see the reference documentation at
535-
http://www.tokbox.com/opentok/libraries/server/python/reference/index.html.
618+
https://tokbox.com/developer/sdks/python/reference/.
536619

537620
Development and Contributing
538621
----------------------------

0 commit comments

Comments
 (0)