@@ -39,9 +39,12 @@ export declare class LiveSession
3939| [close ()](./ai .livesession .md #livesessionclose ) | | <b ><i >(Public Preview )</i ></b > Closes this session . All methods on this session will throw an error once this resolves . |
4040| [receive ()](./ai .livesession .md #livesessionreceive ) | | <b ><i >(Public Preview )</i ></b > Yields messages received from the server . This can only be used by one consumer at a time . |
4141| [send (request , turnComplete )](./ai .livesession .md #livesessionsend ) | | <b ><i >(Public Preview )</i ></b > Sends content to the server . |
42+ | [sendAudioRealtime (blob )](./ai .livesession .md #livesessionsendaudiorealtime ) | | <b ><i >(Public Preview )</i ></b > Sends audio data to the server in realtime . |
4243| [sendFunctionResponses (functionResponses )](./ai .livesession .md #livesessionsendfunctionresponses ) | | <b ><i >(Public Preview )</i ></b > Sends function responses to the server . |
43- | [sendMediaChunks (mediaChunks )](./ai .livesession .md #livesessionsendmediachunks ) | | <b ><i >(Public Preview )</i ></b > Sends realtime input to the server . |
44- | [sendMediaStream (mediaChunkStream )](./ai .livesession .md #livesessionsendmediastream ) | | <b ><i >(Public Preview )</i ></b > Sends a stream of [GenerativeContentBlob ](./ai .generativecontentblob .md #generativecontentblob_interface )<!-- -->. |
44+ | [sendMediaChunks (mediaChunks )](./ai .livesession .md #livesessionsendmediachunks ) | | <b ><i >(Public Preview )</i ></b > |
45+ | [sendMediaStream (mediaChunkStream )](./ai .livesession .md #livesessionsendmediastream ) | | <b ><i >(Public Preview )</i ></b > |
46+ | [sendTextRealtime (text )](./ai .livesession .md #livesessionsendtextrealtime ) | | <b ><i >(Public Preview )</i ></b > Sends text to the server in realtime . |
47+ | [sendVideoRealtime (blob )](./ai .livesession .md #livesessionsendvideorealtime ) | | <b ><i >(Public Preview )</i ></b > Sends video data to the server in realtime . |
4548
4649## LiveSession .inConversation
4750
@@ -135,6 +138,45 @@ Promise<void>
135138
136139If this session has been closed .
137140
141+ ## LiveSession .sendAudioRealtime ()
142+
143+ > This API is provided as a preview for developers and may change based on feedback that we receive . Do not use this API in a production environment .
144+ >
145+
146+ Sends audio data to the server in realtime .
147+
148+ The server requires that the audio data is base64 -encoded 16-bit PCM at 16kHz little -endian .
149+
150+ <b >Signature :</b >
151+
152+ ```typescript
153+ sendAudioRealtime (blob : GenerativeContentBlob ): Promise <void >;
154+ ```
155+
156+ #### Parameters
157+
158+ | Parameter | Type | Description |
159+ | --- | --- | --- |
160+ | blob | [GenerativeContentBlob ](./ai .generativecontentblob .md #generativecontentblob_interface ) | The base64 -encoded PCM data to send to the server in realtime . |
161+
162+ <b >Returns :</b >
163+
164+ Promise < ;void > ;
165+
166+ #### Exceptions
167+
168+ If this session has been closed .
169+
170+ ### Example
171+
172+
173+ ```javascript
174+ // const pcmData = ... base64-encoded 16-bit PCM at 16kHz little-endian.
175+ const blob = { mimeType: " audio/pcm" , data: pcmData };
176+ liveSession .sendAudioRealtime (blob );
177+
178+ ```
179+
138180## LiveSession.sendFunctionResponses()
139181
140182> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
@@ -167,7 +209,12 @@ If this session has been closed.
167209> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
168210>
169211
170- Sends realtime input to the server .
212+ > Warning: This API is now obsolete.
213+ >
214+ > Use ` sendTextRealtime() ` <!-- --> , ` sendAudioRealtime() ` <!-- --> , and ` sendVideoRealtime() ` instead.
215+ >
216+ > Sends realtime input to the server.
217+ >
171218
172219<b >Signature:</b >
173220
@@ -194,7 +241,12 @@ If this session has been closed.
194241> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
195242>
196243
197- Sends a stream of [GenerativeContentBlob ](./ai .generativecontentblob .md #generativecontentblob_interface )<!-- -->.
244+ > Warning: This API is now obsolete.
245+ >
246+ > Use ` sendTextRealtime() ` <!-- --> , ` sendAudioRealtime() ` <!-- --> , and ` sendVideoRealtime() ` instead.
247+ >
248+ > Sends a stream of [ GenerativeContentBlob] ( ./ai.generativecontentblob.md#generativecontentblob_interface ) <!-- --> .
249+ >
198250
199251<b >Signature:</b >
200252
@@ -216,3 +268,77 @@ Promise<void>
216268
217269If this session has been closed.
218270
271+ ## LiveSession.sendTextRealtime()
272+
273+ > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
274+ >
275+
276+ Sends text to the server in realtime.
277+
278+ <b >Signature:</b >
279+
280+ ``` typescript
281+ sendTextRealtime (text : string ): Promise < void > ;
282+ ```
283+
284+ #### Parameters
285+
286+ | Parameter | Type | Description |
287+ | --- | --- | --- |
288+ | text | string | The text data to send. |
289+
290+ <b >Returns:</b >
291+
292+ Promise< ; void> ;
293+
294+ #### Exceptions
295+
296+ If this session has been closed.
297+
298+ ### Example
299+
300+
301+ ``` javascript
302+ liveSession .sendTextRealtime (" Hello, how are you?" );
303+
304+ ```
305+
306+ ## LiveSession.sendVideoRealtime()
307+
308+ > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
309+ >
310+
311+ Sends video data to the server in realtime.
312+
313+ The server requires that the video is sent as individual video frames at 1 FPS. It is recommended to set ` mimeType ` to ` image/jpeg ` <!-- --> .
314+
315+ <b >Signature:</b >
316+
317+ ``` typescript
318+ sendVideoRealtime (blob : GenerativeContentBlob ): Promise < void > ;
319+ ```
320+
321+ #### Parameters
322+
323+ | Parameter | Type | Description |
324+ | --- | --- | --- |
325+ | blob | [ GenerativeContentBlob] ( ./ai.generativecontentblob.md#generativecontentblob_interface ) | The base64-encoded video data to send to the server in realtime. |
326+
327+ <b >Returns:</b >
328+
329+ Promise< ; void> ;
330+
331+ #### Exceptions
332+
333+ If this session has been closed.
334+
335+ ### Example
336+
337+
338+ ``` javascript
339+ // const videoFrame = ... JPEG data
340+ const blob = { mimeType: " image/jpeg" , data: videoFrame };
341+ liveSession .sendAudioRealtime (blob);
342+
343+ ```
344+
0 commit comments