Skip to content

Commit afae255

Browse files
committed
Merge pull request #68 from jeffswartz/archiving_updates_docs
Docs for new features in the Archiving sample app.
2 parents f997235 + a8edff1 commit afae255

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

sample/Archiving/README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,22 @@ generates the three strings that the client (JavaScript) needs to connect to the
7272
URL. The route handler for this URL is shown below:
7373

7474
```python
75-
@app.route("/start")
75+
@app.route("/start", methods=['POST'])
7676
def start():
77-
archive = opentok.start_archive(session.session_id, name="Python Archiving Sample App")
77+
has_audio = 'hasAudio' in request.form.keys()
78+
has_video = 'hasVideo' in request.form.keys()
79+
output_mode = OutputModes[request.form.get('outputMode')]
80+
archive = opentok.start_archive(session.session_id, name="Python Archiving Sample App",
81+
has_audio=has_audio, has_video=has_video, output_mode=output_mode)
7882
return archive.json()
7983
```
8084

81-
In this handler, the `start_archive()` method of the `opentok` instance is called with the `session_id`
82-
for the session that needs to be archived. The optional second argument is `name`, which is stored with
83-
the archive and can be read later. In this case, as in the HelloWorld sample app, there is
85+
In this handler, the `start_archive()` method of the `opentok` instance is called with the
86+
`session_id` for the session that needs to be archived. The remaining arguments are a set of
87+
optional properties for the Archive. The `name` is stored with the archive and can be read later.
88+
The `has_audio`, `has_video`, and `output_mode` values are read from the request body; these define
89+
whether the archive will record audio and video, and whether it will record streams individually or
90+
to a single file composed of all streams. In this case, as in the HelloWorld sample app, there is
8491
only one session created and it is used here and for the participant view. This will trigger the
8592
recording to begin. The response sent back to the client's XHR request will be the JSON
8693
representation of the archive, which is returned from the `json()` method. The client is also

0 commit comments

Comments
 (0)