feat&fix: add task recording endpoint, enhance video player support, and improve mobile responsiveness

This commit is contained in:
adlsdztony
2025-06-01 06:50:02 +00:00
parent cb62b3c877
commit b5efb82172
5 changed files with 255 additions and 8 deletions

View File

@@ -208,6 +208,20 @@ def task_screenshot(task_type, task_id, filename):
else:
return "Screenshot does not exist", 404
@app.route('/task/<task_type>/<task_id>/recording')
def task_recording(task_type, task_id):
"""Get task recording video"""
recording_path = os.path.join(RESULTS_BASE_PATH, task_type, task_id, "recording.mp4")
if os.path.exists(recording_path):
response = send_file(recording_path, mimetype='video/mp4')
# Add headers to improve mobile compatibility
response.headers['Accept-Ranges'] = 'bytes'
response.headers['Cache-Control'] = 'public, max-age=3600'
response.headers['X-Content-Type-Options'] = 'nosniff'
return response
else:
return "Recording does not exist", 404
@app.route('/api/task/<task_type>/<task_id>')
def api_task_detail(task_type, task_id):
"""Task detail API"""