@@ -72,15 +72,22 @@ generates the three strings that the client (JavaScript) needs to connect to the
72
72
URL. The route handler for this URL is shown below:
73
73
74
74
``` python
75
- @app.route (" /start" )
75
+ @app.route (" /start" , methods = [ ' POST ' ] )
76
76
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)
78
82
return archive.json()
79
83
```
80
84
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
84
91
only one session created and it is used here and for the participant view. This will trigger the
85
92
recording to begin. The response sent back to the client's XHR request will be the JSON
86
93
representation of the archive, which is returned from the ` json() ` method. The client is also
0 commit comments