Skip to content

Commit aa209f0

Browse files
committed
Merge branch 'feat/audio_support' of https://github.com/varshith15/comfystream into feat/audio_support
2 parents 6e134b7 + af132be commit aa209f0

File tree

7 files changed

+40
-11
lines changed

7 files changed

+40
-11
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ By default the app will be available at <http://localhost:3000>.
162162

163163
The Stream URL is the URL of the [server](#run-server) which defaults to <http://127.0.0.1:8888>.
164164

165+
> [!NOTE]
166+
> To run the UI on HTTPS (necessary for webcam functionality), use `npm run dev:https`. You'll need to accept the self-signed certificate in your browser.
167+
165168
## Limitations
166169

167170
At the moment, a workflow must fufill the following requirements:

ui/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,5 @@ yarn-error.log*
3838
# typescript
3939
*.tsbuildinfo
4040
next-env.d.ts
41+
42+
certificates

ui/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"private": true,
55
"scripts": {
66
"dev": "next dev",
7+
"dev:https": "next dev --experimental-https",
78
"build": "next build",
89
"start": "next start",
910
"lint": "next lint"

ui/src/app/globals.css

+18
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,24 @@ body {
66
font-family: Arial, Helvetica, sans-serif;
77
}
88

9+
/**
10+
* Prevents iOS Safari from zooming in on focus.
11+
*
12+
* iOS automatically zooms inputs if text is smaller than 16px.
13+
* This enforces `text-base` (16px) on affected elements only on iOS.
14+
*/
15+
@supports (-webkit-touch-callout: none) {
16+
/* Apply the fix to standard text inputs */
17+
.u-ios-text-base {
18+
@apply text-base;
19+
}
20+
21+
/* Apply the fix to file input text */
22+
.u-ios-file-text-base::file-selector-button {
23+
font-size: 16px !important;
24+
}
25+
}
26+
927
@layer base {
1028
:root {
1129
--background: 0 0% 100%;

ui/src/components/room.tsx

+13-8
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,11 @@ function Stage({ connected, onStreamReady }: StageProps) {
154154
);
155155
}
156156

157-
export function Room() {
157+
/**
158+
* Creates a room component for the user to stream their webcam to ComfyStream and
159+
* see the output stream.
160+
*/
161+
export const Room = () => {
158162
const [connect, setConnect] = useState<boolean>(false);
159163
const [isConnected, setIsConnected] = useState<boolean>(false);
160164
const [isStreamSettingsOpen, setIsStreamSettingsOpen] =
@@ -229,15 +233,16 @@ export function Room() {
229233
onDisconnected={handleDisconnected}
230234
localStream={localStream}
231235
>
232-
<div className="min-h-[100dvh] flex flex-col items-center justify-start">
233-
<div className="w-full max-h-[100dvh] flex flex-col lg:flex-row landscape:flex-row justify-center items-center lg:space-x-4 sm:pt-[10vh]">
234-
{/* Output Stream */}
235-
<div className="relative w-full max-w-[100vw] h-auto aspect-square sm:max-w-[512px] sm:max-h-[512px] md:max-w-[512px] md:max-h-[512px] flex justify-center items-center bg-slate-900 sm:border-[2px] md:border-0 lg:border-2 rounded-md">
236+
<div className="min-h-[100dvh] flex flex-col items-center justify-center md:justify-start">
237+
<div className="w-full max-h-[100dvh] flex flex-col md:flex-row landscape:flex-row justify-center items-center lg:space-x-4 md:pt-[10vh]">
238+
{/* Output stream */}
239+
<div className="relative w-full max-w-[100vw] h-auto aspect-square sm:max-w-[640px] sm:max-h-[640px] md:max-w-[512px] md:max-h-[512px] flex justify-center items-center bg-slate-900 sm:border-[2px] md:border-0 lg:border-2 rounded-md">
236240
<Stage
237241
connected={isConnected}
238242
onStreamReady={onRemoteStreamReady}
239243
/>
240-
<div className="absolute bottom-[8px] right-[8px] w-[90px] h-[90px] bg-slate-800 block md:hidden">
244+
{/* Thumbnail (mobile) */}
245+
<div className="absolute bottom-[8px] right-[8px] w-[70px] h-[70px] sm:w-[90px] sm:h-[90px] bg-slate-800 block md:hidden">
241246
<Webcam
242247
onStreamReady={onStreamReady}
243248
deviceId={config.selectedDeviceId}
@@ -246,7 +251,7 @@ export function Room() {
246251
/>
247252
</div>
248253
</div>
249-
{/* Input Stream */}
254+
{/* Input stream (desktop) */}
250255
<div className="hidden md:flex w-full sm:w-full md:w-full h-[50dvh] sm:h-auto md:h-auto max-w-[512px] max-h-[512px] aspect-square justify-center items-center lg:border-2 lg:rounded-md bg-slate-800">
251256
<Webcam
252257
onStreamReady={onStreamReady}
@@ -269,4 +274,4 @@ export function Room() {
269274
</div>
270275
</main>
271276
);
272-
}
277+
};

ui/src/components/ui/input.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
1111
<input
1212
type={type}
1313
className={cn(
14-
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
14+
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 u-ios-text-base u-ios-file-text-base",
1515
className
1616
)}
1717
ref={ref}

ui/src/components/ui/select.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const SelectTrigger = React.forwardRef<
1717
<SelectPrimitive.Trigger
1818
ref={ref}
1919
className={cn(
20-
"flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
20+
"flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 u-ios-text-base",
2121
className
2222
)}
2323
{...props}
@@ -67,7 +67,7 @@ const SelectOption = React.forwardRef<
6767
<SelectPrimitive.Item
6868
ref={ref}
6969
className={cn(
70-
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
70+
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 u-ios-text-base",
7171
className
7272
)}
7373
{...props}

0 commit comments

Comments
 (0)