From e321784a92fad29cfe6d57535dd1240970190e21 Mon Sep 17 00:00:00 2001 From: Zita Szupera Date: Wed, 26 Jul 2023 13:30:38 +0200 Subject: [PATCH] Recording JS code snippets --- .../docs/api/recording/recording_calls.mdx | 222 ++++++++++++++++++ 1 file changed, 222 insertions(+) diff --git a/docusaurus/video/docusaurus/docs/api/recording/recording_calls.mdx b/docusaurus/video/docusaurus/docs/api/recording/recording_calls.mdx index 4ee310c2..ba0b718c 100644 --- a/docusaurus/video/docusaurus/docs/api/recording/recording_calls.mdx +++ b/docusaurus/video/docusaurus/docs/api/recording/recording_calls.mdx @@ -5,12 +5,234 @@ slug: /recording/calls title: Recording calls --- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + ## Enabling / Disabling call recording + + + +```js +// Disable on call level +call.update({ + settings_override: { + recording: { + mode: RecordSettingsRequestModeEnum.DISABLED, + }, + }, +}); + +// Disable on call type level +client.updateCallType('', { + settings: { + recording: { + mode: RecordSettingsModeEnum.DISABLED, + }, + }, +}); + +// Enable +call.update({ + settings_override: { + recording: { + mode: RecordSettingsRequestModeEnum.AVAILABLE, + }, + }, +}); + +// Other settings +call.update({ + settings_override: { + recording: { + audio_only: false, + quality: RecordSettingsRequestQualityEnum._1080P, + }, + }, +}); +``` + + + + ## Start call recording + + + +```js +call.startRecording(); +``` + + + + +```py +def hello_world(): + print("Hello, world!") +``` + + + + +```go +func main() { + apiKey := os.Getenv("API_KEY") + apiSecret := os.Getenv("API_SECRET") + userID := os.Getenv("USER_ID") + url := os.Getenv("URL") + + if apiKey == "" || apiSecret == "" || userID == "" || url == "" { + panic("API_KEY, API_SECRET, USER_ID and URL env variables must be set") + } + + tokenProvider := videosdk.UserToken(apiSecret, userID, 24*time.Hour) + sdk := videosdk.New(apiKey, tokenProvider) + + token, err := tokenProvider(sdk.APIKey()) + if err != nil { + panic(err) + } + + client := videosdk.NewCoordinatorClientSDK(url, sdk.APIKey(), token) + startResponse, err := client.StartRecording(models.CallTypeDefault, callID, &models.StartRecordingRequest{ + Type: "default", ID: callID, + }) + if err != nil { + panic(err) + } + fmt.Println("response", startResponse) + + stopResponse, err := client.StopRecording(models.CallTypeDefault, callID, &models.StopRecordingRequest{ + Type: "default", ID: callID, + }) + if err != nil { + panic(err) + } + + fmt.Println("response", stopResponse) +} +``` + + + + +```bash +curl -X POST "https://video.stream-io-api.com/video/call/default/${CALL_ID}/start_recording?api_key=${API_KEY}" \ +-H "Authorization: ${JWT_TOKEN}" +``` + + + + ## Stop call recording + + + +```js +call.stopRecording(); +``` + + + + +```py +def hello_world(): + print("Hello, world!") +``` + + + + +```go +func main() { + apiKey := os.Getenv("API_KEY") + apiSecret := os.Getenv("API_SECRET") + userID := os.Getenv("USER_ID") + url := os.Getenv("URL") + + if apiKey == "" || apiSecret == "" || userID == "" || url == "" { + panic("API_KEY, API_SECRET, USER_ID and URL env variables must be set") + } + + tokenProvider := videosdk.UserToken(apiSecret, userID, 24*time.Hour) + sdk := videosdk.New(apiKey, tokenProvider) + + token, err := tokenProvider(sdk.APIKey()) + if err != nil { + panic(err) + } + + client := videosdk.NewCoordinatorClientSDK(url, sdk.APIKey(), token) + startResponse, err := client.StartRecording(models.CallTypeDefault, callID, &models.StartRecordingRequest{ + Type: "default", ID: callID, + }) + if err != nil { + panic(err) + } + fmt.Println("response", startResponse) + + stopResponse, err := client.StopRecording(models.CallTypeDefault, callID, &models.StopRecordingRequest{ + Type: "default", ID: callID, + }) + if err != nil { + panic(err) + } + + fmt.Println("response", stopResponse) +} +``` + + + + +```bash +curl -X POST "https://video.stream-io-api.com/video/call/default/${CALL_ID}/start_recording?api_key=${API_KEY}" \ +-H "Authorization: ${JWT_TOKEN}" +``` + + + + ## List call recording + + + +```js +call.queryRecordings(); + +// optionally query recordings for a specific session +call.queryRecordings(''); +``` + + + + +```py +def hello_world(): + print("Hello, world!") +``` + + + + +```go +TODO +``` + + + + +```bash +curl -X GET "https://video.stream-io-api.com/video/call/default/${CALL_ID}/${SESSION_ID}/recordings?api_key=${API_KEY}" \ +-H "Authorization: ${JWT_TOKEN}" +``` + + + + ## Delete call recording + +// TODO: Add API endpoint