same but use url_for
This commit is contained in:
parent
401e7495c7
commit
acbd8b9501
2 changed files with 6 additions and 13 deletions
|
@ -343,18 +343,11 @@ def video_download_route(file_name):
|
|||
|
||||
@app.route('/video/watch/<file_name_no_extension>', methods=['GET'])
|
||||
def video_watch_route(file_name_no_extension):
|
||||
video_file = f'{file_name_no_extension}.mp4'
|
||||
video_path = f'{rec_path}/vod/{video_file}'
|
||||
thumb_path = f'{rec_path}/thumb/{file_name_no_extension}.png'
|
||||
if not os.path.exists(video_path):
|
||||
video_file = f'{rec_path}/vod/{file_name_no_extension}.mp4'
|
||||
thumb_file = f'{rec_path}/thumb/{file_name_no_extension}.png'
|
||||
if not os.path.exists(video_file):
|
||||
abort(404)
|
||||
else:
|
||||
video_url=f'https://{scheduler_hostname}/video/{video_file}'
|
||||
if not os.path.exists(thumb_path):
|
||||
thumb_url = ""
|
||||
else:
|
||||
thumb_url=f'https://{scheduler_hostname}/thumb/{}'
|
||||
return render_template('watch.html', video_url=video_url, thumb_url=thumb_url)
|
||||
return render_template('watch.html', thumb_file=thumb_file, video_file=video_file)
|
||||
|
||||
# Gallery
|
||||
@app.route("/gallery", methods=['GET'])
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta property="og:type" content=video.other>
|
||||
<meta property="og:image" content={{ thumb_url }}>
|
||||
<meta property="og:image" content={{ url_for('thumb_route', file_name=thumb_file) }}>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/plyr/dist/plyr.min.css">
|
||||
<style>
|
||||
body {
|
||||
|
@ -28,7 +28,7 @@
|
|||
|
||||
<div id="player-container">
|
||||
<video id="player" playsinline controls>
|
||||
<source src="{{ video_url }}" type="video/mp4">
|
||||
<source src="{{ url_for('video_route', file_name=video_file) }}" type="video/mp4">
|
||||
</video>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/plyr/dist/plyr.min.js" crossorigin="anonymous"></script>
|
||||
|
|
Loading…
Reference in a new issue