Files
Final-Year-Project/MobileApp/README.md

88 lines
2.0 KiB
Markdown

# SecureCam Mobile (Expo)
React Native mobile client for the SecureCam backend.
## Features migrated from the Svelte web app
- Email/password auth + account creation
- Device onboarding (`camera` or `client` role)
- Realtime socket connection status
- Client dashboard:
- Link/unlink cameras
- Rename linked cameras
- Request live stream sessions
- View frame-based live feed fallback images
- Open recordings by presigned URL
- Activity feed (motion notifications)
- Settings (diagnostics + sign out)
- Camera dashboard:
- Native camera preview (`expo-camera`)
- Frame relay over Socket.IO for stream fallback
- Motion start/end controls
## Prerequisites
- Node.js 20+
- npm
- Expo CLI via `npx expo ...`
- Backend running on port `3000` (default)
## Environment setup
Set the backend URL for the mobile app:
```bash
EXPO_PUBLIC_API_BASE_URL=http://<HOST>:3000
```
You can place this in `MobileApp/.env`.
### Common values
- iOS simulator: `http://localhost:3000`
- Android emulator: `http://10.0.2.2:3000`
- Physical device (same Wi-Fi): `http://<your-lan-ip>:3000`
Example:
```bash
EXPO_PUBLIC_API_BASE_URL=http://192.168.1.25:3000
```
## Install and run
```bash
cd MobileApp
npm install
npm run start
```
Then open via Expo Go / simulator.
## Native module notes
This app uses `expo-camera` for native camera preview and frame capture.
If your environment is offline, dependency installation may fail. Once network is available, run:
```bash
cd MobileApp
npx expo install expo-camera socket.io-client
```
## WebRTC note
Current native mobile live viewing still uses the legacy `stream:frame` fallback path.
The backend `SIMPLE_STREAMING` flag therefore defaults to `false` for safe rollout.
For full native WebRTC publish/subscribe parity, add a supported RN WebRTC stack (for example `react-native-webrtc`) and replace frame relay with peer connection flows equivalent to the web client before enabling `SIMPLE_STREAMING` by default.
## Verification
```bash
cd MobileApp
npm run lint
npx tsc --noEmit
```