enable multi thread and video jumping

This commit is contained in:
xingxinghuo1000 2022-02-07 19:44:01 +08:00
parent 28a1ac1612
commit 34db877bf6
1 changed files with 7 additions and 2 deletions

View File

@ -93,7 +93,12 @@ def main():
mimetype = None
try:
return send_file(requested_path, mimetype=mimetype, as_attachment=send_as_attachment)
if extension in ('.mp4', '.avi', '.mkv'):
# if video file is found, then use conditional flag, to enable video jumping
# you can slide to any part of the video and then play
return send_file(requested_path, mimetype=mimetype, as_attachment=send_as_attachment, conditional=True)
else:
return send_file(requested_path, mimetype=mimetype, as_attachment=send_as_attachment)
except PermissionError:
abort(403, 'Read Permission Denied: ' + requested_path)
@ -177,7 +182,7 @@ def main():
if args.ssl:
ssl_context = 'adhoc'
run_simple("0.0.0.0", int(args.port), app, ssl_context=ssl_context)
run_simple("0.0.0.0", int(args.port), app, ssl_context=ssl_context, threaded=True)
if __name__ == '__main__':