Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions examples/realtime-video/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,35 @@
build:
npm run build

deploy:

clean:
rm -rf node_modules package-lock.json dist

install:
npm install

clean-install: clean install

local-dev:
npm run dev

local-build:
npm run build
cp schema.json dist
cd dist && sed -i'' -e 's/"\/assets/"\.\/assets/g' index.html

local-preview: local-build
npm run preview

deploy-prep:
npm run build
cp schema.json dist
cd dist && sed -i'' -e 's/"\/assets/"\.\/assets/g' index.html

deploy: deploy-prep
git add -f dist
git commit -m 'publish demo'
git push

deploy-with-upstream: deploy-prep
git add -f dist
git commit -m 'publish demo'
git push --set-upstream origin $(shell git branch --show-current)
53 changes: 52 additions & 1 deletion examples/realtime-video/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,54 @@
## Realtime Video

A real-time, peer-to-peer module application that displays a video feed from a camera, allowing users to connect and view the feed simply by knowing the camera name.
A real-time, peer-to-peer module application that displays a video feed from a camera, allowing users to connect and view the feed simply by knowing the camera name.

## Features

- Real-time H.264 video streaming with bandwidth optimization
- WebRTC connection management

## Node.js Polyfills

This module uses Vite with Node.js polyfills to handle Formant SDK dependencies that contain Node.js-specific code. The polyfills are configured in:

- **vite.config.ts**: Uses `vite-plugin-node-polyfills` for automatic polyfills
- **src/polyfills.ts**: Manual polyfill for `setImmediate` (required for WebRTC)

## Local Development

```bash
# Install dependencies
make install

# Clean install (useful when updating SDK versions)
make clean-install

# Local development server (port 5173)
make local-dev

# Test built version locally (port 4173)
make local-preview
```

## Deployment

```bash
# Prepare deployment files
make deploy-prep

# Deploy to current branch
make deploy

# Deploy to new branch (sets upstream automatically)
make deploy-with-upstream
```

## Troubleshooting

If you encounter "process is not defined" or "setImmediate is not defined" errors:

1. Ensure `vite-plugin-node-polyfills` is installed
2. Verify `src/polyfills.ts` is imported first in `src/main.tsx`
3. Check that Vite config includes the node polyfills plugin

These polyfills are required because the Formant SDK contains webpack-bundled code with Node.js globals that Vite needs help handling.
210 changes: 0 additions & 210 deletions examples/realtime-video/dist/assets/index-643462ad.js

This file was deleted.

264 changes: 264 additions & 0 deletions examples/realtime-video/dist/assets/index-90298d3b.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/realtime-video/dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
<script type="module" crossorigin src="./assets/index-643462ad.js"></script>
<script type="module" crossorigin src="./assets/index-90298d3b.js"></script>
<link rel="stylesheet" href="./assets/index-99e015fe.css">
</head>
<body>
Expand Down
Loading