Fix iOS video playback in list views
Use video_src_for_request() for iOS MP4 transcoding in: - ui_runs partial - ui_cache_list partial - ui_run_partial (also added request parameter) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
17
server.py
17
server.py
@@ -1426,7 +1426,8 @@ async def ui_runs(request: Request):
|
|||||||
<div class="flex justify-center">
|
<div class="flex justify-center">
|
||||||
''')
|
''')
|
||||||
if input_media_type == "video":
|
if input_media_type == "video":
|
||||||
html_parts.append(f'<video src="/cache/{input_hash}" controls muted loop playsinline class="max-h-32 rounded"></video>')
|
input_video_src = video_src_for_request(input_hash, request)
|
||||||
|
html_parts.append(f'<video src="{input_video_src}" controls muted loop playsinline class="max-h-32 rounded"></video>')
|
||||||
elif input_media_type == "image":
|
elif input_media_type == "image":
|
||||||
html_parts.append(f'<img src="/cache/{input_hash}" alt="input" class="max-h-32 rounded">')
|
html_parts.append(f'<img src="/cache/{input_hash}" alt="input" class="max-h-32 rounded">')
|
||||||
html_parts.append('</div></div>')
|
html_parts.append('</div></div>')
|
||||||
@@ -1441,7 +1442,8 @@ async def ui_runs(request: Request):
|
|||||||
<div class="flex justify-center">
|
<div class="flex justify-center">
|
||||||
''')
|
''')
|
||||||
if output_media_type == "video":
|
if output_media_type == "video":
|
||||||
html_parts.append(f'<video src="/cache/{output_hash}" controls autoplay muted loop playsinline class="max-h-32 rounded"></video>')
|
output_video_src = video_src_for_request(output_hash, request)
|
||||||
|
html_parts.append(f'<video src="{output_video_src}" controls autoplay muted loop playsinline class="max-h-32 rounded"></video>')
|
||||||
elif output_media_type == "image":
|
elif output_media_type == "image":
|
||||||
html_parts.append(f'<img src="/cache/{output_hash}" alt="output" class="max-h-32 rounded">')
|
html_parts.append(f'<img src="/cache/{output_hash}" alt="output" class="max-h-32 rounded">')
|
||||||
html_parts.append('</div></div>')
|
html_parts.append('</div></div>')
|
||||||
@@ -1551,7 +1553,8 @@ async def ui_cache_list(
|
|||||||
''')
|
''')
|
||||||
|
|
||||||
if media_type == "video":
|
if media_type == "video":
|
||||||
html_parts.append(f'<video src="/cache/{content_hash}" controls muted loop playsinline class="max-h-32 rounded"></video>')
|
video_src = video_src_for_request(content_hash, request)
|
||||||
|
html_parts.append(f'<video src="{video_src}" controls muted loop playsinline class="max-h-32 rounded"></video>')
|
||||||
elif media_type == "image":
|
elif media_type == "image":
|
||||||
html_parts.append(f'<img src="/cache/{content_hash}" alt="{content_hash[:16]}" class="max-h-32 rounded object-contain">')
|
html_parts.append(f'<img src="/cache/{content_hash}" alt="{content_hash[:16]}" class="max-h-32 rounded object-contain">')
|
||||||
else:
|
else:
|
||||||
@@ -1871,7 +1874,7 @@ async def ui_detail_page(run_id: str, request: Request):
|
|||||||
|
|
||||||
|
|
||||||
@app.get("/ui/run/{run_id}", response_class=HTMLResponse)
|
@app.get("/ui/run/{run_id}", response_class=HTMLResponse)
|
||||||
async def ui_run_partial(run_id: str):
|
async def ui_run_partial(run_id: str, request: Request):
|
||||||
"""HTMX partial: single run (for polling updates)."""
|
"""HTMX partial: single run (for polling updates)."""
|
||||||
run = load_run(run_id)
|
run = load_run(run_id)
|
||||||
if not run:
|
if not run:
|
||||||
@@ -1942,7 +1945,8 @@ async def ui_run_partial(run_id: str):
|
|||||||
<div class="flex justify-center">
|
<div class="flex justify-center">
|
||||||
'''
|
'''
|
||||||
if input_media_type == "video":
|
if input_media_type == "video":
|
||||||
html += f'<video src="/cache/{input_hash}" controls muted loop playsinline class="max-h-32 rounded"></video>'
|
input_video_src = video_src_for_request(input_hash, request)
|
||||||
|
html += f'<video src="{input_video_src}" controls muted loop playsinline class="max-h-32 rounded"></video>'
|
||||||
elif input_media_type == "image":
|
elif input_media_type == "image":
|
||||||
html += f'<img src="/cache/{input_hash}" alt="input" class="max-h-32 rounded">'
|
html += f'<img src="/cache/{input_hash}" alt="input" class="max-h-32 rounded">'
|
||||||
html += '</div></div>'
|
html += '</div></div>'
|
||||||
@@ -1956,7 +1960,8 @@ async def ui_run_partial(run_id: str):
|
|||||||
<div class="flex justify-center">
|
<div class="flex justify-center">
|
||||||
'''
|
'''
|
||||||
if output_media_type == "video":
|
if output_media_type == "video":
|
||||||
html += f'<video src="/cache/{output_hash}" controls autoplay muted loop playsinline class="max-h-32 rounded"></video>'
|
output_video_src = video_src_for_request(output_hash, request)
|
||||||
|
html += f'<video src="{output_video_src}" controls autoplay muted loop playsinline class="max-h-32 rounded"></video>'
|
||||||
elif output_media_type == "image":
|
elif output_media_type == "image":
|
||||||
html += f'<img src="/cache/{output_hash}" alt="output" class="max-h-32 rounded">'
|
html += f'<img src="/cache/{output_hash}" alt="output" class="max-h-32 rounded">'
|
||||||
html += '</div></div>'
|
html += '</div></div>'
|
||||||
|
|||||||
Reference in New Issue
Block a user