### Add Sound File to Expo Project Source: https://getstream.io/video/docs/react-native/incoming-calls/callkit-optional-setup.md Example of how to configure the iosRingtone property in app.json for Expo. ```json { "plugins": [ [ "@stream-io/video-react-native-sdk", { "ringing": true, "iosRingtone": "./assets/ringtone.caf" } ] ] } ``` -------------------------------- ### Optional Camera Support Example Source: https://getstream.io/video/docs/react-native/setup/installation/react-native.md Example of setting camera hardware as optional in AndroidManifest.xml. ```xml ``` -------------------------------- ### Client setup & Calls Source: https://getstream.io/video/docs/react-native/setup/quickstart.md This code snippet demonstrates how to set up the StreamVideoClient, create a call object, and join the call. It also shows how to wrap your UI with StreamVideo and StreamCall components. ```tsx import { StreamCall, StreamVideo, StreamVideoClient, User, } from "@stream-io/video-react-native-sdk"; import { useEffect, useState } from "react"; const apiKey = "your-api-key"; const userId = "user-id"; const token = "authentication-token"; const callId = "my-call-id"; const user: User = { id: userId }; const client = StreamVideoClient.getOrCreateInstance({ apiKey, user, token }); const call = client.call("default", callId); call.join({ create: true }); export default function App() { return ( {/* Your UI */} ); } ``` -------------------------------- ### Golang Go Live Example Source: https://getstream.io/video/docs/react-native/streaming/overview.md Demonstrates how to call the `GoLive` method in Golang, with optional parameters to start HLS broadcast, recording, closed captions, and transcription. ```go call.GoLive(ctx, &getstream.GoLiveRequest{}) # Optionally start processes that are set to `available` call.GoLive(ctx, &getstream.GoLiveRequest{ # Optionally start HLS broadcast StartHLS: getstream.PtrTo(true), # Optionally start recording the call StartRecording: getstream.PtrTo(true), # Optionally start displaying closed captions for call participants StartClosedCaption: getstream.PtrTo(true), # Optionally start saving the call transcription to a file StartTranscription: getstream.PtrTo(true), # Optionally select storage for the recording file (if none is specified, the default storage will be used) RecordingStorageName: getstream.PtrTo(""), # Optionally select storage for the transcription file (if none is specified, the default storage will be used) TranscriptionStorageName: getstream.PtrTo("") }) ``` -------------------------------- ### Start HLS, Recording, Closed Captions, and Transcription Source: https://getstream.io/video/docs/react-native/streaming/backstage.md This example demonstrates how to start HLS broadcast, recording, closed captions, and transcription for a call, along with specifying storage for recordings and transcriptions. ```go call.GoLive(ctx, &getstream.GoLiveRequest{}) // Optionally start processes that are set to `available` call.GoLive(ctx, &getstream.GoLiveRequest{ // Optionally start HLS broadcast StartHLS: getstream.PtrTo(true), // Optionally start recording the call StartRecording: getstream.PtrTo(true), // Optionally start displaying closed captions for call participants StartClosedCaption: getstream.PtrTo(true), // Optionally start saving the call transcription to a file StartTranscription: getstream.PtrTo(true), // Optionally select storage for the recording file (if none is specified, the default storage will be used) RecordingStorageName: getstream.PtrTo(""), // Optionally select storage for the transcription file (if none is specified, the default storage will be used) TranscriptionStorageName: getstream.PtrTo("") }) ``` ```curl curl -X POST "https://video.stream-io-api.com/api/v2/video/call/livestream/${CALL_ID}/go_live?api_key=${API_KEY}" \ -H "Authorization: ${TOKEN}" \ -H "stream-auth-type: jwt" \ -H "Content-Type: application/json" \ -d '{ "start_hls": true, # Optionally start HLS broadcast "start_recording": true, # Optionally start recording the call "start_closed_caption": true, # Optionally start displaying closed captions for call participants "start_transcription": true, # Optionally start saving the call transcription to a file "recording_storage_name": "", # Optionally select storage for the recording file (if none is specified, the default storage will be used) "transcription_storage_name": "" # Optionally select storage for the transcription file (if none is specified, the default storage will be used) }' ``` -------------------------------- ### Golang Example Source: https://getstream.io/video/docs/react-native/call-types/settings.md Example of creating a call type with custom notification settings using Golang. ```go client.Video().CreateCallType(ctx, &getstream.CreateCallTypeRequest{ Name: "test-call-type", NotificationSettings: &getstream.NotificationSettings{ Enabled: true, CallNotification: getstream.EventNotificationSettings{ APNS: getstream.APNS{ Title: "{{ user.display_name }} calls you", Body: "{{ user.display_name }} calls you", }, Enabled: true, }, CallRing: getstream.EventNotificationSettings{ APNS: getstream.APNS{ Title: "{{ user.display_name }} calls you", Body: "{{ user.display_name }} calls you", }, Enabled: true, }, CallLiveStarted: getstream.EventNotificationSettings{ Enabled: true, APNS: getstream.APNS{ Title: "{{ call.display_name }} started", Body: "{{ user.display_name }} started", }, }, CallMissed: getstream.EventNotificationSettings{ Enabled: true, APNS: getstream.APNS{ Title: "missed call from {{ user.display_name }}", Body: "missed call from {{ user.display_name }}", }, }, SessionStarted: getstream.EventNotificationSettings{ Enabled: true, APNS: getstream.APNS{ Title: "{{ call.display_name }} started", Body: "{{ call.display_name }} started", }, }, }, }) ``` -------------------------------- ### Singleton client example Source: https://getstream.io/video/docs/react-native/advanced/troubleshooting.md Example of using a singleton client for StreamVideoClient. ```tsx const client = StreamVideoClient.getOrCreateInstance({ apiKey, user, token, }); ``` -------------------------------- ### JavaScript Go Live Example Source: https://getstream.io/video/docs/react-native/streaming/overview.md Demonstrates how to call the `goLive` method in JavaScript, with optional parameters to start HLS broadcast, recording, closed captions, and transcription. ```javascript call.goLive(); // Optionally start processes that are set to `available` call.goLive({ // Optionally start HLS broadcast start_hls: true, // Optionally start recording the call start_recording: true, // Optionally start displaying closed captions for call participants start_closed_caption: true, // Optionally start saving the call transcription to a file start_transcription: true, // Optionally select storage for the recording file (if none is specified, the default storage will be used) recording_storage_name: "", // Optionally select storage for the transcription file (if none is specified, the default storage will be used) transcription_storage_name: "", # Optionally select storage for the recording file (if none is specified, the default storage will be used) \ "transcription_storage_name": "" # Optionally select storage for the transcription file (if none is specified, the default storage will be used) \ }' ``` -------------------------------- ### Run Setup Script Source: https://getstream.io/video/docs/react-native/ui-cookbook/session-timers.md Command to run the TypeScript setup script. ```bash npx ts-node script.ts ``` -------------------------------- ### JavaScript Example Source: https://getstream.io/video/docs/react-native/call-types/settings.md Example of creating a call type with custom notification settings using JavaScript. ```javascript client.video.createCallType({ name: "", notification_settings: { enabled: true, call_notification: { apns: { title: "{{ user.display_name }} calls you", body: "{{ user.display_name }} calls you", }, enabled: true, }, call_ring: { apns: { title: "{{ user.display_name }} calls you", body: "{{ user.display_name }} calls you", }, enabled: true, }, call_live_started: { enabled: true, apns: { title: "{{ call.display_name }} started", body: "{{ user.display_name }} started", }, }, call_missed: { enabled: true, apns: { title: "missed call from {{ user.display_name }}", body: "missed call from {{ user.display_name }}", }, }, session_started: { enabled: true, apns: { title: "{{ call.display_name }} started", body: "{{ call.display_name }} started", }, }, }, }); ``` -------------------------------- ### Install Dependencies Source: https://getstream.io/video/docs/react-native/guides/keeping-call-alive.md Installs the necessary package for iOS CallKit integration and installs pods. ```bash yarn add @stream-io/react-native-callingx npx pod-install ``` -------------------------------- ### Golang Examples for Transcription Language Source: https://getstream.io/video/docs/react-native/transcribing/calls.md Illustrates how to configure the transcription language in Golang for call types, individual calls during creation and update, and for starting transcription. ```go //set the language for all calls of the default type to "fr" client.Video().UpdateCallType(ctx, "default", &getstream.UpdateCallTypeRequest{ Settings: &getstream.CallSettingsRequest{ Transcription: &getstream.TranscriptionSettingsRequest{ Language: getstream.PtrTo("fr"), }, }, }) // create a call and set its language to "fr" call.GetOrCreate(ctx, &getstream.CallRequest{ SettingsOverride: &getstream.CallSettingsRequest{ Transcription: &getstream.TranscriptionSettingsRequest{ Language: getstream.PtrTo("fr"), }, }, }) // update an existing call and set its language to "fr" call.Update(ctx, &getstream.UpdateCallRequest{ SettingsOverride: &getstream.CallSettingsRequest{ Transcription: &getstream.TranscriptionSettingsRequest{ Language: getstream.PtrTo("fr"), }, }, }) // start transcription and set language to "fr" call.StartTranscription(ctx, &getstream.StartTranscriptionRequest{ Language: getstream.PtrTo("fr"), }) ``` -------------------------------- ### Call Instance Management Example Source: https://getstream.io/video/docs/react-native/guides/calling-state-and-lifecycle.md Demonstrates how to create, get, getOrCreate, join, and leave a call instance using the Stream Video React Native SDK. ```typescript import { Call, StreamVideoClient } from "@stream-io/video-react-native-sdk"; let client: StreamVideoClient; // ... const call: Call = client.call(type, id); // load existing call information from our servers await call.get(); // Creates the call on our servers in case it doesn't exist. Otherwise, // loads the call information from our servers. await call.getOrCreate(); // join the call await call.join(); // leave the call and dispose all allocated resources await call.leave(); ``` -------------------------------- ### Install SDK Source: https://getstream.io/video/docs/react-native/setup/installation/react-native.md Installs the Stream Video React Native SDK using Yarn. ```bash yarn add @stream-io/video-react-native-sdk ``` -------------------------------- ### Basic Application Setup Source: https://getstream.io/video/docs/react-native/ui-cookbook/manual-video-quality-selection.md This code snippet demonstrates the basic setup for a React Native application using the GetStream Video SDK, including client initialization, user setup, and joining a call. ```tsx import React, { useEffect } from "react"; import { SafeAreaView, StyleSheet, Text } from "react-native"; import { Call, StreamCall, CallContent, CallingState, StreamVideoClient, StreamVideo, } from "@stream-io/video-react-native-sdk"; const apiKey = "REPLACE_WITH_API_KEY"; const token = "REPLACE_WITH_TOKEN"; const userId = "REPLACE_WITH_USER_ID"; const callId = "REPLACE_WITH_CALL_ID"; const user = { id: userId, name: "John Malkovich", image: "https://robohash.org/John", }; const client = new StreamVideoClient({ apiKey, user, token }); const RootContainer = (props: React.PropsWithChildren<{}>) => { return {props.children}; }; export const App = () => { const [call, setCall] = React.useState(); useEffect(() => { const _call = client.call("default", callId); _call.join({ create: true }).then(() => setCall(_call)); return () => { _call.leave().catch(() => console.error("Failed to leave the call")); setCall(undefined); }; }, []); if (!call) { return ( Joining call... ); } return ( ); }; const styles = StyleSheet.create({ container: { flex: 1, justifyContent: "center", backgroundColor: "white", }, text: { color: "black", fontSize: 20, fontWeight: "bold", marginBottom: 20, textAlign: "center", }, }); export default App; ``` -------------------------------- ### cURL Example Source: https://getstream.io/video/docs/react-native/call-types/settings.md Example of creating a call type with custom notification settings using cURL. ```bash curl -X POST "https://video.stream-io-api.com/api/v2/video/calltypes?api_key=${API_KEY}" \ -H "Authorization: ${TOKEN}" \ -H "stream-auth-type: jwt" \ -H "Content-Type: application/json" \ -d '{ \ "name": "", \ "notification_settings": { \ "enabled": true, \ "call_notification": { \ "apns": { \ "title": "{{ user.display_name }} calls you", \ "body": "{{ user.display_name }} calls you" \ }, \ "enabled": true \ }, \ "call_ring": { \ "apns": { \ "title": "{{ user.display_name }} calls you", \ "body": "{{ user.display_name }} calls you" \ }, \ "enabled": true \ }, \ "call_live_started": { \ "enabled": true, \ "apns": { \ "title": "{{ call.display_name }} started", \ "body": "{{ user.display_name }} started" \ } \ }, \ "call_missed": { \ "enabled": true, \ "apns": { \ "title": "missed call from {{ user.display_name }}", \ "body": "missed call from {{ user.display_name }}" \ } \ }, ``` -------------------------------- ### Golang Example Source: https://getstream.io/video/docs/react-native/recording/storage.md Demonstrates how to create, check, and update external storage configurations using the Stream client in Golang. ```go // 1. create a new storage with all the required parameters client.CreateExternalStorage(ctx, &getstream.CreateExternalStorageRequest{ Name: "my-s3", StorageType: "s3", Bucket: "my-bucket", Path: getstream.PtrTo("directory_name/"), AwsS3: &getstream.S3Request{ S3Region: "us-east-1", S3APIKey: getstream.PtrTo("my-access"), S3Secret: getstream.PtrTo("my-secret"), }, }) // 2. (Optional) Check storage configuration for correctness // In case of any errors, this will throw a StreamAPIException. response, err := client.CheckExternalStorage(ctx, "my-s3", &getstream.CheckExternalStorageRequest{}) // 3. update the call type to use the new storage client.Video().UpdateCallType(ctx, "allhands", &getstream.UpdateCallTypeRequest{ ExternalStorage: getstream.PtrTo("my-s3"), }) ``` -------------------------------- ### Backstage Mode Example Source: https://getstream.io/video/docs/react-native/guides/livestreaming.md This example demonstrates how to display a countdown or start date for a livestream and show the number of waiting participants. It uses the `useCallSession` and `useCallStartsAt` hooks to get call information and formats the start date for display. ```tsx import React from "react"; import { View, Text, StyleSheet } from "react-native"; import { useCallStateHooks } from "@stream-io/video-react-native-sdk"; export const Backstage = () => { const { useCallSession, useCallStartsAt } = useCallStateHooks(); const startsAt = useCallStartsAt(); const session = useCallSession(); // participants who are waiting const waitingCount = session?.participants_count_by_role["user"] || 0; const formattedStartsAt = startsAt && new Date(startsAt).toLocaleDateString(undefined, { month: "short", day: "2-digit", hour: "2-digit", minute: "2-digit", hour12: false, }); return ( {startsAt ? ( Livestream starting at {formattedStartsAt} ) : ( Livestream starting soon )} {waitingCount > 0 && ( {waitingCount} participants waiting )} ); }; const styles = StyleSheet.create({ container: { flex: 1, justifyContent: "center", alignItems: "center", }, title: { fontSize: 18, fontWeight: "bold", marginBottom: 8, }, waitingCount: { fontSize: 16, paddingHorizontal: 16, }, }); ``` -------------------------------- ### Start and stop call recording Source: https://getstream.io/video/docs/react-native/recording/calls.md Examples for starting and stopping call recordings in JavaScript, Python, Golang, and cURL. ```javascript // starts recording call.startRecording(); // stops the recording for the call call.stopRecording(); ``` ```python # starts recording call.start_recording() # stops the recording for the call call.stop_recording() ``` ```go // starts recording call.StartRecording(ctx, &getstream.StartRecordingRequest{}) // stops the recording for the call call.StopRecording(ctx, &getstream.StopRecordingRequest{}) ``` ```bash curl -X POST "https://video.stream-io-api.com/api/v2/video/call/${CALL_TYPE}/${CALL_ID}/start_recording?api_key=${API_KEY}" \ -H "Authorization: ${TOKEN}" \ -H "stream-auth-type: jwt" curl -X POST "https://video.stream-io-api.com/api/v2/video/call/${CALL_TYPE}/${CALL_ID}/stop_recording?api_key=${API_KEY}" \ -H "Authorization: ${TOKEN}" \ -H "stream-auth-type: jwt" ``` -------------------------------- ### Python Example Source: https://getstream.io/video/docs/react-native/recording/storage.md Demonstrates how to create, check, and update external storage configurations using the Stream client in Python. ```python # 1. create a new storage with all the required parameters from getstream.models.s_3_request import S3Request client.create_external_storage( name='my-s3', storage_type='s3', bucket='my-bucket', path='directory_name/', aws_s3=S3Request( s3_region='us-east-1', s3_api_key='my-access-key', s3_secret='my-secret', ), ) # 2. (Optional) Check storage configuration for correctness # In case of any errors, this will throw a StreamAPIException. response = client.check_external_storage(name='my-s3') # 3. update the call type to use the new storage client.video.update_call_type(name='allhands', external_storage='my-s3') ``` -------------------------------- ### Calls that are about to start Source: https://getstream.io/video/docs/react-native/guides/querying-calls.md This example shows how to query livestream calls that are scheduled to start within the next 30 minutes. It filters by call type and start time, and sorts the results by start time. ```typescript import { StreamVideoClient } from "@stream-io/video-react-native-sdk"; let client: StreamVideoClient; const inNext30mins = new Date(Date.now() + 1000 * 60 * 60 * 30); const { calls } = await client.queryCalls({ filter_conditions: { type: { $eq: "livestream" }, starts_at: { $gt: inNext30mins.toISOString() }, }, sort: [{ field: "starts_at", direction: -1 }], limit: 10, watch: true, }); ``` -------------------------------- ### Backstage Setup Source: https://getstream.io/video/docs/react-native/guides/joining-and-creating-calls.md Illustrates how to enable backstage mode for hosts, allowing them to set up cameras before going live, and how to configure join ahead time for regular users. ```typescript await call.getOrCreate({ data: { starts_at: new Date(Date.now() + 500 * 1000), // 500 seconds from now settings_override: { backstage: { enabled: true, join_ahead_time_seconds: 300, }, }, }, }); ``` -------------------------------- ### Start and Stop HLS Broadcast (Golang) Source: https://getstream.io/video/docs/react-native/streaming/hls.md Provides examples for starting and stopping HLS broadcasts using the GetStream Video SDK in Golang. ```go call.StartHLSBroadcasting(ctx, &getstream.StartHLSBroadcastingRequest{}) // to end broadcasting call.StopHLSBroadcasting(ctx, &getstream.StopHLSBroadcastingRequest{}) ``` -------------------------------- ### cURL Example Source: https://getstream.io/video/docs/react-native/recording/storage.md Demonstrates how to create, check, and update external storage configurations using cURL commands. ```bash # 1. create a new storage with all the required parameters curl -X POST https://video.stream-io-api.com/video/external_storage?api_key=${API_KEY} \ -H "Authorization: ${TOKEN}" \ -H "Content-Type: application/json" \ -H "stream-auth-type: jwt" \ -d '{ "name": "my-storage", "storage_type": "s3", "bucket": "my-bucket", "path": "my-folder", "aws_s3": { "s3_region": "us-east-1", "s3_api_key": "my-api-key", "s3_secret": "my-secret" } }' # 2. (Optional) Check storage configuration for correctness curl -X GET https://video.stream-io-api.com/video/external_storage/check?api_key=${API_KEY} \ -H "Authorization: ${TOKEN}" \ -H "stream-auth-type: jwt" # 3. update the call type to use the new storage curl -X PUT https://video.stream-io-api.com/api/v2/video/calltypes/${CALL_TYPE}?api_key=${API_KEY} \ -H "Authorization: ${TOKEN}" \ -H "Content-Type: application/json" \ -H "stream-auth-type: jwt" \ -d '{ "external_storage": "my-storage" }' ``` -------------------------------- ### JavaScript Example Source: https://getstream.io/video/docs/react-native/recording/storage.md Demonstrates how to create, check, and update external storage configurations using the Stream client in JavaScript. ```javascript // 1. create a new storage with all the required parameters await client.createExternalStorage({ bucket: "my-bucket", name: "my-s3", storage_type: "s3", path: "directory_name/", aws_s3: { s3_region: "us-east-1", s3_api_key: "my-access-key", s3_secret: "my-secret", }, }); // 2. (Optional) Check storage configuration for correctness // In case of any errors, this will throw a ResponseError. await client.checkExternalStorage({ name: "my-s3", }); // 3. update the call type to use the new storage await client.video.updateCallType({ name: "my-call-type", external_storage: "my-s3", }); ``` -------------------------------- ### MainActivity.kt Source: https://getstream.io/video/docs/react-native/guides/screensharing/react-native.md Enable MediaProjectionService in MainActivity.kt. ```kotlin override fun onCreate(savedInstanceState: Bundle?) { val options: WebRTCModuleOptions = WebRTCModuleOptions.getInstance() options.enableMediaProjectionService = true // ..the rest } ``` -------------------------------- ### Get Active Calls Status - cURL Source: https://getstream.io/video/docs/react-native/quality/stats.md Example of how to retrieve the active calls status using a cURL request. ```bash curl -X GET "https://video.stream-io-api.com/api/v2/video/active_calls_status?api_key=${API_KEY}" \ -H "Authorization: ${TOKEN}" \ -H "stream-auth-type: jwt" ``` -------------------------------- ### Golang - Override settings on call level Source: https://getstream.io/video/docs/react-native/call-types/geofencing.md Example of overriding geofencing settings when getting or creating a call in Golang. ```go // override settings on call level call.GetOrCreate(ctx, &getstream.GetOrCreateCallRequest{ Data: &getstream.CallRequest{ CreatedByID: getstream.PtrTo("john"), SettingsOverride: &getstream.CallSettingsRequest{ Geofencing: &getstream.GeofenceSettingsRequest{ Names: []string{"european_union", "united_states"}, }, }, }, }) ``` -------------------------------- ### MainActivity.kt Source: https://getstream.io/video/docs/react-native/guides/screensharing/react-native.md Add import for WebRTCModuleOptions in MainActivity.kt. ```kotlin import com.oney.WebRTCModule.WebRTCModuleOptions ``` -------------------------------- ### Single-Call Concurrency Source: https://getstream.io/video/docs/react-native/advanced/integration-best-practices.md Example of enabling auto-reject for busy users when creating or getting a StreamVideoClient instance. ```typescript const client = StreamVideoClient.getOrCreateInstance({ apiKey, tokenProvider, user, options: { rejectCallWhenBusy: true }, }); ``` -------------------------------- ### Configure Custom Ringtone in React Native Source: https://getstream.io/video/docs/react-native/incoming-calls/callkit-optional-setup.md Example of how to set the custom ringtone filename in StreamVideoRN.setPushConfig for iOS. ```javascript StreamVideoRN.setPushConfig({ ios: { sound: "ringtone", // Match your file name (without extension) // ... rest options }, // ... rest of your configuration }); ``` -------------------------------- ### MainActivity.java Source: https://getstream.io/video/docs/react-native/guides/screensharing/react-native.md Enable MediaProjectionService in MainActivity.java. ```java @Override protected void onCreate(Bundle savedInstanceState) { WebRTCModuleOptions options = WebRTCModuleOptions.getInstance(); options.enableMediaProjectionService = true; // ..the rest } ``` -------------------------------- ### Custom PiP component setup Source: https://getstream.io/video/docs/react-native/advanced/pip.md Example of using RTCViewPipIOS for custom Picture-in-Picture rendering. ```tsx import { RTCViewPipIOS } from "@stream-io/video-react-native-sdk"; <> ; ``` -------------------------------- ### Get Active Calls Status - JavaScript Source: https://getstream.io/video/docs/react-native/quality/stats.md Example of how to retrieve the active calls status using the Stream Video JavaScript client. ```javascript const response = await client.video.getActiveCallsStatus(); ``` -------------------------------- ### Get Active Calls Status - Python Source: https://getstream.io/video/docs/react-native/quality/stats.md Example of how to retrieve the active calls status using the Stream Video Python client. ```python response = client.video.get_active_calls_status() print( f"There are {response.data.summary.active_calls} calls " f"currently running and {response.data.summary.participants} " f"connected users" ) ``` -------------------------------- ### Audio Routing Lifecycle Source: https://getstream.io/video/docs/react-native/advanced/integration-best-practices.md Example of managing audio routing using callManager, starting when joining a call and stopping when leaving. ```tsx import { callManager } from "@stream-io/video-react-native-sdk"; // Before joining a call (or immediately after joining) callManager.start({ audioRole: "communicator", deviceEndpointType: "speaker", }); // When leaving a call callManager.stop(); ``` -------------------------------- ### Create External Storage (S3) Source: https://getstream.io/video/docs/react-native/recording/storage.md Example of creating an external S3 storage configuration using Golang. ```go client.CreateExternalStorage(ctx, &getstream.CreateExternalStorageRequest{ Name: "my-s3", StorageType: "s3", Bucket: "my-bucket", Path: getstream.PtrTo("directory_name/"), AWSS3: &getstream.S3Request{ S3Region: "us-east-1", S3APIKey: getstream.PtrTo("my-access-key"), S3Secret: getstream.PtrTo("my-secret"), }, }, ) ``` -------------------------------- ### MainActivity.java Source: https://getstream.io/video/docs/react-native/guides/screensharing/react-native.md Add import for WebRTCModuleOptions in MainActivity.java. ```java import com.oney.WebRTCModule.WebRTCModuleOptions; ``` -------------------------------- ### Configure Custom Icon Name in React Native Source: https://getstream.io/video/docs/react-native/incoming-calls/callkit-optional-setup.md Example of how to set the custom icon image name in StreamVideoRN.setPushConfig for iOS. ```javascript StreamVideoRN.setPushConfig({ ios: { imageName: "callkit_icon", // Match your image set name // ... rest options }, // ... rest of your configuration }); ``` -------------------------------- ### Golang Examples for Call Recording Source: https://getstream.io/video/docs/react-native/recording/calls.md Illustrates how to control call recording settings in Golang, covering disabling on call and call type levels, automatic recording, and enabling with quality options. ```go // Disable on call level call.Update(ctx, &getstream.UpdateCallRequest{ SettingsOverride: &getstream.CallSettingsRequest{ Recording: &getstream.RecordSettingsRequest{ Mode: "disabled", }, }, }) // Disable on call type level call_type_name := "default" client.Video().UpdateCallType(ctx, call_type_name, &getstream.UpdateCallTypeRequest{ Settings: &getstream.CallSettingsRequest{ Recording: &getstream.RecordSettingsRequest{ Mode: "disabled", }, }, }) // Automatically record calls client.Video().UpdateCallType(ctx, call_type_name, &getstream.UpdateCallTypeRequest{ Settings: &getstream.CallSettingsRequest{ Recording: &getstream.RecordSettingsRequest{ Mode: "auto-on", Quality: getstream.PtrTo("720p"), }, }, }) // Enable recording feature for a specific call call.Update(ctx, &getstream.UpdateCallRequest{ SettingsOverride: &getstream.CallSettingsRequest{ Recording: &getstream.RecordSettingsRequest{ Mode: "available", }, }, }) // Other settings call.Update(ctx, &getstream.UpdateCallRequest{ SettingsOverride: &getstream.CallSettingsRequest{ Recording: &getstream.RecordSettingsRequest{ Mode: "available", Quality: getstream.PtrTo("1080p"), }, }, }) ``` -------------------------------- ### Screen Share with Audio Option Source: https://getstream.io/video/docs/react-native/guides/screensharing/react-native.md Example of enabling screen sharing with audio by setting `includeAudio: true` in `screenShareOptions`. ```tsx ``` -------------------------------- ### User Blocking (cURL) Source: https://getstream.io/video/docs/react-native/moderation/overview.md Examples of blocking, getting blocked users, and unblocking users using cURL. ```bash curl -X POST https://video.stream-io-api.com/api/v2/users/block?api_key=${API_KEY} \ -H "Authorization: ${TOKEN}" \ -H "stream-auth-type: jwt" \ -H 'Content-Type: application/json' \ -d '{ "blocked_user_id": "bob", "user_id": "alice" }' USER_ID='alice'; ENCODED_USER_ID=$(echo ${USER_ID} | perl -MURI::Escape -lne 'print uri_escape($_)') curl -X GET "https://video.stream-io-api.com/api/v2/users/block?api_key=${API_KEY}&user_id=${ENCODED_USER_ID}" \ -H "Authorization: ${TOKEN}" \ -H "stream-auth-type: jwt" curl -X POST https://video.stream-io-api.com/api/v2/users/unblock?api_key=${API_KEY} \ -H "Authorization: ${TOKEN}" \ -H "stream-auth-type: jwt" \ -H 'Content-Type: application/json' \ -d '{ "blocked_user_id": "bob", "user_id": "alice" }' ``` -------------------------------- ### StreamVideoClient Initialization Source: https://getstream.io/video/docs/react-native/advanced/integration-best-practices.md Example of creating and managing a StreamVideoClient instance using useEffect for proper lifecycle management. ```typescript const [client, setClient] = useState(); useEffect(() => { const tokenProvider = async () => api.fetchToken(user.id); const client = StreamVideoClient.getOrCreateInstance({ apiKey, user, tokenProvider, }); setClient(client); return () => { client.disconnectUser().catch((err) => console.error(err)); setClient(undefined); }; }, [apiKey, user.id]); ``` -------------------------------- ### List Permissions Source: https://getstream.io/video/docs/react-native/call-types/permissions.md Examples of how to list permissions using various client SDKs. ```javascript const response = await client.listPermissions(); console.log(response.permissions); ``` ```python response = client.list_permissions() print(response.permissions) ``` ```go request := &getstream.ListPermissionsRequest{} response, err := client.ListPermissions(ctx, request) fmt.Printf("Permissions: %+v\n", response) ``` ```java var request = client.listPermissions(); var response = request.execute(); System.out.println("Permission IDs:"); response.getData().getPermissions().forEach(permission -> { System.out.println("- " + permission.getId()); }); ``` ```bash curl -X GET "https://video.stream-io-api.com/api/v2/video/permissions?api_key=${API_KEY}" \ -H "Authorization: ${TOKEN}" \ -H "stream-auth-type: jwt" ``` -------------------------------- ### User Blocking (Golang) Source: https://getstream.io/video/docs/react-native/moderation/overview.md Examples of blocking, getting blocked users, and unblocking users using the Golang SDK. ```go // alice blocks bob client.BlockUsers(ctx, &getstream.BlockUsersRequest{ BlockedUserID: "bob.ID", UserID: &alice.ID, }) // list blocked users by alice response, err := client.GetBlockedUsers(ctx, &getstream.GetBlockedUsersRequest{ UserID: &alice.ID, }) // alice unblocks bob client.UnblockUsers(ctx, &getstream.UnblockUsersRequest{ BlockedUserID: bob.ID, UserID: &alice.ID, }) ``` -------------------------------- ### User Blocking (Python) Source: https://getstream.io/video/docs/react-native/moderation/overview.md Examples of blocking, getting blocked users, and unblocking users using the Python SDK. ```python # alice blocks bob client.block_users(blocked_user_id=bob.id, user_id=alice.id) # list blocked users by alice response = client.get_blocked_users(user_id=alice.id) # alice unblocks bob client.unblock_users(blocked_user_id=bob.id, user_id=alice.id) ``` -------------------------------- ### User Blocking (JavaScript) Source: https://getstream.io/video/docs/react-native/moderation/overview.md Examples of blocking, getting blocked users, and unblocking users using the JavaScript SDK. ```javascript client.blockUsers({ blocked_user_id: "bob", user_id: "alice", }); client.getBlockedUsers({ user_id: "alice" }); client.unblockUsers({ blocked_user_id: "bob", user_id: "alice", }); ``` -------------------------------- ### In-App Screen Sharing with `useScreenShareButton` Hook Source: https://getstream.io/video/docs/react-native/guides/screensharing/react-native.md Example of using the `useScreenShareButton` hook with the in-app screen sharing option and including audio. ```tsx const { onPress, hasPublishedScreenShare } = useScreenShareButton( screenCapturePickerViewiOSRef, onStarted, onStopped, onMissingScreenSharePermission, { type: "inApp", includeAudio: true }, ); ``` -------------------------------- ### Golang Example Source: https://getstream.io/video/docs/react-native/recording/calls.md Update call type settings to enable custom recording with a Golang client. ```go client.Video().UpdateCallType(ctx, "callTypeName", &getstream.UpdateCallTypeRequest{ Settings: &getstream.CallSettingsRequest{ Recording: &getstream.RecordSettingsRequest{ Mode: "available", AudioOnly: getstream.PtrTo(false), Quality: getstream.PtrTo("1080p"), Layout: &getstream.LayoutSettingsRequest{ Name: "custom", ExternalAppUrl: getstream.PtrTo("https://path/to/layout/app"), }, }, }, }) ``` -------------------------------- ### cURL Commands for Transcription Source: https://getstream.io/video/docs/react-native/transcribing/calls.md Shows example cURL commands to start and stop transcription for a call, including necessary headers and parameters. ```bash curl -X POST "https://video.stream-io-api.com/api/v2/video/call/default/${CALL_ID}/start_transcription?api_key=${API_KEY}" -H "Authorization: ${TOKEN}" -H "stream-auth-type: jwt" curl -X POST "https://video.stream-io-api.com/api/v2/video/call/default/${CALL_ID}/stop_transcription?api_key=${API_KEY}" -H "Authorization: ${TOKEN}" -H "stream-auth-type: jwt" ``` -------------------------------- ### Install Node.js SDK Source: https://getstream.io/video/docs/react-native/ui-cookbook/session-timers.md Install the Stream.io Node.js SDK using yarn or npm. ```yarn yarn add @stream-io/node-sdk ``` ```npm npm install @stream-io/node-sdk ``` -------------------------------- ### Initialize notification setup at app startup Source: https://getstream.io/video/docs/react-native/incoming-calls/non-ringing-notifications-setup/react-native.md Initializes the notification listeners and tap handlers when the application starts, ensuring they are active before the React lifecycle begins. ```javascript import { AppRegistry } from "react-native"; import { setNotificationListeners } from "src/utils/setNotificationListeners"; import { registerNonRingingNotificationHandler } from "src/utils/registerNonRingingNotifications"; import App from "./App"; setNotificationListeners(); // Registers push listeners and notification handlers registerNonRingingNotificationHandler(); // Registers tap handlers AppRegistry.registerComponent("app", () => App); ``` -------------------------------- ### Golang Layout Options Source: https://getstream.io/video/docs/react-native/recording/calls.md Example of configuring layout options for call recordings using Golang. ```go layoutOptions := map[string]any{ "logo.image_url": "https://theme.zdassets.com/theme_assets/9442057/efc3820e436f9150bc8cf34267fff4df052a1f9c.png", "logo.horizontal_position": "center", "title.text": "Building Stream Video Q&A", "title.horizontal_position": "center", "title.color": "black", "participant_label.border_radius": "0px", "participant.border_radius": "0px", "layout.spotlight.participants_bar_position": "top", "layout.background_color": "#f2f2f2", "participant.placeholder_background_color": "#1f1f1f", "layout.single-participant.padding_inline": "20%", "participant_label.background_color": "transparent", } client.Video().UpdateCallType(ctx, "callTypeName", &getstream.UpdateCallTypeRequest{ Settings: &getstream.CallSettingsRequest{ Recording: &getstream.RecordSettingsRequest{ Mode: "available", AudioOnly: getstream.PtrTo(false), Quality: getstream.PtrTo("1080p"), Layout: &getstream.LayoutSettingsRequest{ Name: "spotlight", Options: &layoutOptions, }, }, }, }) ``` -------------------------------- ### MainApplication.kt Source: https://getstream.io/video/docs/react-native/advanced/troubleshooting.md Configuration for WebRTC module in MainApplication.kt for Android. ```kt import com.oney.WebRTCModule.WebRTCModuleOptions import org.webrtc.Logging override fun onCreate() { val options: WebRTCModuleOptions = WebRTCModuleOptions.getInstance() options.loggingSeverity = Logging.Severity.LS_VERBOSE // the rest } ``` -------------------------------- ### Getting RTMP URL and stream key Source: https://getstream.io/video/docs/react-native/advanced/broadcasting.md Example of how to retrieve the RTMP URL and stream key using useCallIngress hook and user token. ```typescript import { useCallStateHooks } from "@stream-io/video-react-native-sdk"; const { useCallIngress } = useCallStateHooks(); const ingress = useCallIngress(); const rtmpURL = ingress?.rtmp.address; const streamKey = myUserAuthService.getUserToken(myUserAuthId); console.log("RTMP url:", rtmpURL, "Stream key:", streamKey); ``` -------------------------------- ### Create External Storage (S3) Source: https://getstream.io/video/docs/react-native/recording/storage.md Example of creating an external S3 storage configuration using Python. ```python from getstream.models import S3Request client.create_external_storage( bucket="my-bucket", name="stream-s3", storage_type="s3", path="directory_name/", aws_s3=S3Request( s3_region="us-east-1", s3_api_key="my-access-key", s3_secret="my-secret", ), ) ``` -------------------------------- ### Python Examples for Call Recording Source: https://getstream.io/video/docs/react-native/recording/calls.md Provides Python code examples for managing call recording settings, including disabling on call and call type levels, automatic recording, and enabling with specific quality. ```python from getstream.models import RecordSettingsRequest # Disable on call level call.update( settings_override=CallSettingsRequest( recording=RecordSettingsRequest( mode='disabled', ), ), ) # Disable on call type level call_type_name = 'default' client.video.update_call_type(call_type_name, settings=CallSettingsRequest( recording=RecordSettingsRequest( mode='disabled', ), ), ) # Automatically record calls client.video.update_call_type(call_type_name, settings=CallSettingsRequest( recording=RecordSettingsRequest( mode="auto-on", quality="720p", ), ), ) # Enable recording feature for a specific call call.update( settings_override=CallSettingsRequest( recording=RecordSettingsRequest( mode="available", ), ), ) # Other settings call.update( settings_override=CallSettingsRequest( recording=RecordSettingsRequest( mode="available", quality="1080p", ), ), ) ```