diff --git a/app/assistant/index.tsx b/app/assistant/index.tsx index 35cdeb8..3ff6afd 100644 --- a/app/assistant/index.tsx +++ b/app/assistant/index.tsx @@ -14,6 +14,7 @@ import { useLocalParticipant, useParticipantTracks, useRoomContext, + LiveKitRoom, VideoTrack, } from '@livekit/react-native'; import { SafeAreaView } from 'react-native-safe-area-context'; @@ -30,9 +31,16 @@ import { } from '@livekit/components-react'; import { useConnection } from '@/hooks/useConnection'; +const LIVEKIT_URL = 'wss://speechplus-vs6wggn9.livekit.cloud'; +const LIVEKIT_TOKEN = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NjkzMjI5NTYsImlkZW50aXR5IjoiaXNpYWgiLCJpc3MiOiJBUEkzUDg4RmZnanRlQzMiLCJuYmYiOjE3NjkzMjIwNTYsInN1YiI6ImlzaWFoIiwidmlkZW8iOnsiY2FuUHVibGlzaCI6dHJ1ZSwiY2FuUHVibGlzaERhdGEiOnRydWUsImNhblN1YnNjcmliZSI6dHJ1ZSwicm9vbSI6InJvb20iLCJyb29tSm9pbiI6dHJ1ZX19.f0Qg45EinAoNg0qxdoGbuDRwZiyZyLXm06pF9A3_1z8' + + + +// This is where the app actually starts and holds pretty much all of the UI export default function AssistantScreen() { - // Start the audio session first. - useEffect(() => { + + // ESSENTIAL TO START THE SESSION AUDIO ON IOS + useEffect(() => { let start = async () => { await AudioSession.startAudioSession(); }; @@ -42,11 +50,19 @@ export default function AssistantScreen() { AudioSession.stopAudioSession(); }; }, []); - + return ( - - - + + + + + ); } @@ -55,6 +71,7 @@ const RoomView = () => { const connection = useConnection(); const room = useRoomContext(); + useIOSAudioManagement(room, true); const { @@ -190,6 +207,7 @@ const RoomView = () => { /> ); + }; const styles = StyleSheet.create({ diff --git a/hooks/useConnection.tsx b/hooks/useConnection.tsx index d6e5b90..e8776ed 100644 --- a/hooks/useConnection.tsx +++ b/hooks/useConnection.tsx @@ -3,7 +3,7 @@ import { createContext, useContext, useMemo, useState } from 'react'; import { SessionProvider, useSession } from '@livekit/components-react'; // TODO: Add your Sandbox ID here -const sandboxID = ''; +const sandboxID = 'speechplus-1fjqy1'; // The name of the agent you wish to be dispatched. const agentName = undefined @@ -13,8 +13,8 @@ const agentName = undefined // and using one of your API Keys to generate a token with custom TTL and permissions. // For use without a token server. -const hardcodedUrl = ''; -const hardcodedToken = ''; +const hardcodedUrl = 'wss://speechplus-vs6wggn9.livekit.cloud'; +const hardcodedToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NjkyOTA3NTIsImlkZW50aXR5IjoiaXNpYWgiLCJpc3MiOiJBUEkzUDg4RmZnanRlQzMiLCJuYmYiOjE3NjkyODk4NTIsInN1YiI6ImlzaWFoIiwidmlkZW8iOnsiY2FuUHVibGlzaCI6dHJ1ZSwiY2FuUHVibGlzaERhdGEiOnRydWUsImNhblN1YnNjcmliZSI6dHJ1ZSwicm9vbSI6IlJvb20iLCJyb29tSm9pbiI6dHJ1ZX19.psc1kLcY_O0xYDszgZVNnSY-27yD53eKf6N9qPF_Ww0'; interface ConnectionContextType { isConnectionActive: boolean; @@ -22,6 +22,7 @@ interface ConnectionContextType { disconnect: () => void; } + const ConnectionContext = createContext({ isConnectionActive: false, connect: () => {}, diff --git a/package-lock.json b/package-lock.json index 796b234..fc8dbf6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,12 +11,13 @@ "@config-plugins/react-native-webrtc": "13.0.0", "@expo/vector-icons": "^15.0.3", "@livekit/components-react": "^2.9.15", - "@livekit/react-native": "^2.9.5", + "@livekit/react-native": "^2.9.6", "@livekit/react-native-expo-plugin": "^1.0.1", - "@livekit/react-native-webrtc": "^137.0.0", + "@livekit/react-native-webrtc": "^137.0.2", "@react-navigation/bottom-tabs": "^7.2.0", "@react-navigation/native": "^7.0.14", "expo": "^54.0.22", + "expo-av": "^16.0.8", "expo-constants": "~18.0.10", "expo-dev-client": "~6.0.16", "expo-font": "~14.0.9", @@ -25,7 +26,7 @@ "expo-status-bar": "~3.0.8", "expo-symbols": "~1.0.7", "expo-system-ui": "~6.0.8", - "livekit-client": "^2.15.16", + "livekit-client": "^2.17.0", "react": "19.1.0", "react-dom": "19.1.0", "react-native": "0.81.5", @@ -3501,15 +3502,15 @@ } }, "node_modules/@livekit/react-native": { - "version": "2.9.5", - "resolved": "https://registry.npmjs.org/@livekit/react-native/-/react-native-2.9.5.tgz", - "integrity": "sha512-APQaUwStw1q/1SPisSH0pxbfuX+uJPjFq//99xK+ijl/Vkcnop6uBLaLWrvC5H475xi2DOyK+lKmlEfQX4mXeQ==", + "version": "2.9.6", + "resolved": "https://registry.npmjs.org/@livekit/react-native/-/react-native-2.9.6.tgz", + "integrity": "sha512-4DOFJ/OO4yftZbm90QnVMDjwFXqSw2hcruSVO2idgwFxylDmH6NN2e1rs5ZCQPsnqlfwuMGz8vNfuYt++G4C/A==", "license": "Apache-2.0", "workspaces": [ "example" ], "dependencies": { - "@livekit/components-react": "^2.8.1", + "@livekit/components-react": "^2.9.17", "@livekit/mutex": "^1.1.1", "array.prototype.at": "^1.1.1", "base64-js": "1.5.1", @@ -3594,6 +3595,62 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "license": "MIT" }, + "node_modules/@livekit/react-native/node_modules/@floating-ui/dom": { + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.7.4.tgz", + "integrity": "sha512-OOchDgh4F2CchOX94cRVqhvy7b3AFb+/rQXyswmzmGakRfkMgoWVjfnLWkRirfLEfuD4ysVW16eXzwt3jHIzKA==", + "license": "MIT", + "dependencies": { + "@floating-ui/core": "^1.7.3", + "@floating-ui/utils": "^0.2.10" + } + }, + "node_modules/@livekit/react-native/node_modules/@livekit/components-core": { + "version": "0.12.12", + "resolved": "https://registry.npmjs.org/@livekit/components-core/-/components-core-0.12.12.tgz", + "integrity": "sha512-DQ+lOAMPvum37Ta4lQLETxQe7ZxhivI78ZfE4nnWP0AcnwNByNR2vVLp9VGvw577HmvgHEkbjBbGBJBSZEBEZA==", + "license": "Apache-2.0", + "dependencies": { + "@floating-ui/dom": "1.7.4", + "loglevel": "1.9.1", + "rxjs": "7.8.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "livekit-client": "^2.15.14", + "tslib": "^2.6.2" + } + }, + "node_modules/@livekit/react-native/node_modules/@livekit/components-react": { + "version": "2.9.19", + "resolved": "https://registry.npmjs.org/@livekit/components-react/-/components-react-2.9.19.tgz", + "integrity": "sha512-VEa4SsiwCHreuIdjxVPrqoWY+Ezq36fHc6swawDXcROPZMCPOeAovaxw83yZqqCKDpzT6oWoeBFDMbxbMytqRw==", + "license": "Apache-2.0", + "dependencies": { + "@livekit/components-core": "0.12.12", + "clsx": "2.1.1", + "events": "^3.3.0", + "jose": "^6.0.12", + "usehooks-ts": "3.1.1" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@livekit/krisp-noise-filter": "^0.2.12 || ^0.3.0", + "livekit-client": "^2.16.0", + "react": ">=18", + "react-dom": ">=18", + "tslib": "^2.6.2" + }, + "peerDependenciesMeta": { + "@livekit/krisp-noise-filter": { + "optional": true + } + } + }, "node_modules/@livekit/react-native/node_modules/event-target-shim": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-6.0.2.tgz", @@ -3606,6 +3663,19 @@ "url": "https://github.com/sponsors/mysticatea" } }, + "node_modules/@livekit/react-native/node_modules/loglevel": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.9.1.tgz", + "integrity": "sha512-hP3I3kCrDIMuRwAwHltphhDM1r8i55H33GgqjXbrisuJhF4kRhW1dNuxsRklp4bXl8DSdLaNLuiL4A/LWRfxvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6.0" + }, + "funding": { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/loglevel" + } + }, "node_modules/@napi-rs/wasm-runtime": { "version": "0.2.8", "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.8.tgz", @@ -8356,6 +8426,23 @@ "react-native": "*" } }, + "node_modules/expo-av": { + "version": "16.0.8", + "resolved": "https://registry.npmjs.org/expo-av/-/expo-av-16.0.8.tgz", + "integrity": "sha512-cmVPftGR/ca7XBgs7R6ky36lF3OC0/MM/lpgX/yXqfv0jASTsh7AYX9JxHCwFmF+Z6JEB1vne9FDx4GiLcGreQ==", + "license": "MIT", + "peerDependencies": { + "expo": "*", + "react": "*", + "react-native": "*", + "react-native-web": "*" + }, + "peerDependenciesMeta": { + "react-native-web": { + "optional": true + } + } + }, "node_modules/expo-constants": { "version": "18.0.10", "resolved": "https://registry.npmjs.org/expo-constants/-/expo-constants-18.0.10.tgz", @@ -11974,9 +12061,9 @@ "license": "MIT" }, "node_modules/livekit-client": { - "version": "2.16.0", - "resolved": "https://registry.npmjs.org/livekit-client/-/livekit-client-2.16.0.tgz", - "integrity": "sha512-2iYJ4dok17yV5CGeaY1yaFvz7rMuNUmXN1+nXvhUrkxTS/RcuteWTpxwrgLG/Vl1yxkf/YquVQ7bbRwFye20CA==", + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/livekit-client/-/livekit-client-2.17.0.tgz", + "integrity": "sha512-BD1QUS44ancVTBdnAher0aO7DV5holFYH2lYradYT/HgXtn6R8xPyvtDAH3UH40jGcesDo9fEopCFwEdOgrIhg==", "license": "Apache-2.0", "peer": true, "dependencies": { diff --git a/package.json b/package.json index 6141217..792917b 100644 --- a/package.json +++ b/package.json @@ -20,12 +20,13 @@ "@config-plugins/react-native-webrtc": "13.0.0", "@expo/vector-icons": "^15.0.3", "@livekit/components-react": "^2.9.15", - "@livekit/react-native": "^2.9.5", + "@livekit/react-native": "^2.9.6", "@livekit/react-native-expo-plugin": "^1.0.1", - "@livekit/react-native-webrtc": "^137.0.0", + "@livekit/react-native-webrtc": "^137.0.2", "@react-navigation/bottom-tabs": "^7.2.0", "@react-navigation/native": "^7.0.14", "expo": "^54.0.22", + "expo-av": "^16.0.8", "expo-constants": "~18.0.10", "expo-dev-client": "~6.0.16", "expo-font": "~14.0.9", @@ -34,7 +35,7 @@ "expo-status-bar": "~3.0.8", "expo-symbols": "~1.0.7", "expo-system-ui": "~6.0.8", - "livekit-client": "^2.15.16", + "livekit-client": "^2.17.0", "react": "19.1.0", "react-dom": "19.1.0", "react-native": "0.81.5",