Skip to content
This repository was archived by the owner on Oct 30, 2025. It is now read-only.

Commit c9197bc

Browse files
Merge pull request #9 from dyte-io/feat/create-your-own-ui
feat(create-your-own-ui-sample): added sample to speed up integration for vanilla js
2 parents 78ae72d + 5fd2985 commit c9197bc

29 files changed

+1874
-7
lines changed

.github/workflows/deploy.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
name: Deploy
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- run: |
16+
# npm install - Not needed
17+
npm run build
18+
19+
- name: Deploy to Production
20+
uses: cloudflare/wrangler-action@v3
21+
with:
22+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
23+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
24+
wranglerVersion: "4.19.1"
25+
command: pages deploy ./dist

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
# Dyte UI Kit - HTML Samples
1+
# RealtimeKit - HTML Samples
22

3-
This repository consists of all the different ways in which you can use Dyte's
4-
UI Kit and other packages to its full extent to get the best live audio/video
5-
experience.
3+
This repository consists of all the different ways in which you can use RealtimeKit and other packages to its full extent to get the best live audio/video experience.
64

75
## Samples
86

@@ -11,6 +9,7 @@ Here are the list of available samples at the moment.
119
1. [Default Meeting UI](./samples/default-meeting-ui/)
1210
2. [Using Background Transformer to modify your background](./samples/with-background-transformer/)
1311
3. [Background Transformer UI sample](./samples/background-transformer-ui/)
12+
4. [Create Your Own UI](./samples/create-your-own-ui/)
1413

1514
## Usage
1615

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "html-samples",
33
"scripts": {
44
"format": "prettier -w samples",
5+
"build": "npm run postbuild",
56
"postbuild": "./postbuild.sh",
67
"deploy": "wrangler pages deploy ./dist"
78
},

samples/background-transformer-ui/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Background Transformer UI sample
22

3-
This sample showcases how you can modify your background while in a Dyte video
3+
This sample showcases how you can modify your background while in a RealtimeKit video
44
call with the
55
[`@cloudflare/realtimekit-virtual-background`](https://www.npmjs.com/package/@cloudflare/realtimekit-virtual-background)
66
package.
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
# Create Your Own UI Sample
2+
3+
This sample demonstrates how to create a custom meeting UI using Cloudflare RealtimeKit with vanilla HTML, CSS, and JavaScript. It showcases custom components for setup screen, in-meeting experience, control bar, sidebar, and media preview functionality.
4+
5+
## Features
6+
7+
- **Custom Setup Screen**: Participant preview with media settings
8+
- **Media Preview Modal**: Audio and video device selection with preview
9+
- **Custom Control Bar**: Meeting controls with custom sidebar toggle
10+
- **Custom Sidebar**: Standard tabs (chat, participants, polls, plugins) plus custom "warnings" tab
11+
- **Custom Meeting Header**: Logo, indicators, meeting title, and controls
12+
- **Responsive Design**: Built with Tailwind CSS for modern UI
13+
- **State Management**: Uses simple reactive state implementation
14+
- **No Build Steps**: Pure HTML/CSS/JS implementation
15+
16+
## Getting Started
17+
18+
### Prerequisites
19+
20+
- A valid Cloudflare RealtimeKit auth token
21+
- A local web server (like `serve` or `live-server`)
22+
23+
### Installation
24+
25+
1. Clone or download this repository
26+
2. Navigate to the `html-samples` directory
27+
3. Install dependencies (optional, for development server):
28+
```bash
29+
npm install
30+
```
31+
32+
### Running the Sample
33+
34+
1. Start a local server:
35+
```bash
36+
npx serve samples/create-your-own-ui
37+
```
38+
39+
2. Open your browser and navigate to:
40+
```
41+
http://localhost:3000/?authToken=<your-auth-token>
42+
```
43+
44+
Replace `<your-auth-token>` with your actual Cloudflare RealtimeKit auth token.
45+
46+
## Project Structure
47+
48+
```
49+
create-your-own-ui/
50+
├── index.html # Main HTML file
51+
├── store.js # Simple reactive state management
52+
├── utils.js # Utility functions
53+
├── types.js # Type definitions
54+
├── components/ # Component files
55+
│ ├── setup-screen.js/css # Custom setup screen
56+
│ ├── custom-rtk-meeting.js/css # Main meeting wrapper
57+
│ ├── in-meeting.js/css # In-meeting layout
58+
│ ├── meeting-header.js/css # Meeting header
59+
│ ├── meeting-control-bar.js/css # Control bar
60+
│ ├── meeting-sidebar.js/css # Custom sidebar
61+
│ ├── media-preview-modal.js/css # Media preview
62+
│ ├── audio-preview.js/css # Audio device preview
63+
│ └── video-preview.js/css # Video device preview
64+
└── README.md # This file
65+
```
66+
67+
## Key Components
68+
69+
### Setup Screen
70+
- Participant tile with avatar and name tag
71+
- Audio visualizer
72+
- Mic/camera toggles
73+
- Media preview modal access
74+
- Name editing (if permitted)
75+
- Join button
76+
77+
### Media Preview Modal
78+
- Tabbed interface for audio/video settings
79+
- Device selection dropdowns
80+
- Audio visualizer for microphone
81+
- Video preview tile
82+
- Speaker test functionality
83+
84+
### Control Bar
85+
- Left: Fullscreen, settings, screen share
86+
- Center: Mic, camera, stage, leave, more menu
87+
- Right: Chat, polls, participants, plugins, custom sidebar toggle
88+
89+
### Custom Sidebar
90+
- Standard RTK tabs: chat, participants, polls, plugins
91+
- Custom "warnings" tab with example content
92+
- Responsive design
93+
94+
## Customization
95+
96+
### Adding New Components
97+
1. Create `.js` and `.css` files in the `components/` directory
98+
2. Add script and link tags to `index.html`
99+
3. Implement the component using the module pattern
100+
4. Ensure proper cleanup in the component's cleanup function
101+
102+
### State Management
103+
- Use `window.StatesStore.statesStore` for RTK states
104+
- Use `window.StatesStore.customStatesStore` for custom states
105+
- Subscribe to state changes using `window.StatesStore.subscribe()`
106+
107+
### Styling
108+
- Uses Tailwind CSS via CDN
109+
- Component-specific styles in individual CSS files
110+
- Dark theme with consistent color scheme
111+
112+
## Dependencies
113+
114+
- **Cloudflare RealtimeKit**: Core meeting functionality
115+
- **Cloudflare RealtimeKit UI**: Pre-built UI components
116+
- **Simple Reactive State**: Custom reactive state implementation
117+
- **Tailwind CSS**: Utility-first CSS framework
118+
119+
All dependencies are loaded via CDN, no build process required.
120+
121+
## Browser Support
122+
123+
This sample works in modern browsers that support:
124+
- ES6 modules
125+
- Custom elements
126+
- WebRTC
127+
- Modern CSS features
128+
129+
## Troubleshooting
130+
131+
### Common Issues
132+
133+
1. **Auth Token Error**: Ensure you're passing a valid `authToken` in the URL
134+
2. **Components Not Loading**: Check browser console for script loading errors
135+
3. **State Not Updating**: Verify reactive state subscriptions are properly set up
136+
4. **Media Devices**: Ensure browser permissions for camera/microphone access
137+
138+
### Debug Mode
139+
140+
The meeting object is exposed on `window.meeting` for debugging purposes. Open browser dev tools and inspect the meeting object to troubleshoot issues.
141+
142+
### State Subscription Issues
143+
144+
If components aren't updating when states change, ensure you're subscribing to the store object, not the nested states:
145+
-`window.StatesStore.subscribe(statesStore, callback)`
146+
-`window.StatesStore.subscribe(statesStore.states, callback)`
147+
148+
## License
149+
150+
This sample is provided as-is for demonstration purposes.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/* Audio Preview Component Styles */
2+
3+
#audio-device-select,
4+
#speaker-device-select {
5+
border: 1px solid #333;
6+
border-radius: 4px;
7+
}
8+
9+
#audio-device-select:focus,
10+
#speaker-device-select:focus {
11+
outline: none;
12+
border-color: #2160FD;
13+
}
14+
15+
#test-speaker-btn {
16+
background-color: #1F1F1F !important;
17+
border: 1px solid #333;
18+
}
19+
20+
#test-speaker-btn:hover {
21+
background-color: #333 !important;
22+
}
23+
24+
#audio-visualizer {
25+
margin-top: 8px;
26+
height: 40px;
27+
}

0 commit comments

Comments
 (0)