Skip to content

Commit 1c064d6

Browse files
committed
Allow using browser with video disabled
1 parent c8d7112 commit 1c064d6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

llmstack/common/runner/playwright/browser.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ def get_browser(self, request_iterator: Iterator[PlaywrightBrowserRequest]) -> I
243243
.input(f"{display['DISPLAY']}.0", format='x11grab', framerate=10, video_size=(1024, 720))
244244
.output('pipe:', format='mp4', vcodec='h264', movflags='faststart+frag_keyframe+empty_moov+default_base_moof', g=25, y=None)
245245
.run_async(pipe_stdout=True, pipe_stderr=True)
246-
) if initial_request.stream_video else None
246+
)
247247

248248
# Use ThreadPoolExecutor to run the async function in a separate thread
249249
with futures.ThreadPoolExecutor(thread_name_prefix='async_tasks') as executor:
@@ -317,7 +317,8 @@ async def read_video_output():
317317
if chunk is SENTINAL:
318318
video_done = True
319319
break
320-
yield PlaywrightBrowserResponse(video=chunk)
320+
if initial_request.stream_video:
321+
yield PlaywrightBrowserResponse(video=chunk)
321322
except asyncio.QueueEmpty:
322323
pass
323324

@@ -330,7 +331,8 @@ async def read_video_output():
330331
if chunk is SENTINAL:
331332
video_done = True
332333
break
333-
yield PlaywrightBrowserResponse(video=chunk)
334+
if initial_request.stream_video:
335+
yield PlaywrightBrowserResponse(video=chunk)
334336

335337
yield PlaywrightBrowserResponse(
336338
state=RemoteBrowserState.TERMINATED)

0 commit comments

Comments
 (0)