define video viewer
This commit is contained in:
parent
64386d03e6
commit
1ee561636e
2 changed files with 33 additions and 1 deletions
|
@ -22,6 +22,7 @@ logger_api.setLevel(log_level)
|
||||||
logger_job.setLevel(log_level)
|
logger_job.setLevel(log_level)
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
|
scheduler_hostname = os.environ.get('SCHEDULER_API_HOSTNAME', 'tv.example.com')
|
||||||
core_sync_period = int(os.environ.get('CORE_SYNC_PERIOD', 15))
|
core_sync_period = int(os.environ.get('CORE_SYNC_PERIOD', 15))
|
||||||
api_hostname = os.environ.get('CORE_API_HOSTNAME', 'stream.example.com')
|
api_hostname = os.environ.get('CORE_API_HOSTNAME', 'stream.example.com')
|
||||||
api_username = os.environ.get('CORE_API_AUTH_USERNAME', 'admin')
|
api_username = os.environ.get('CORE_API_AUTH_USERNAME', 'admin')
|
||||||
|
@ -311,7 +312,7 @@ def database_route():
|
||||||
|
|
||||||
@app.route("/video/<file_name>", methods=['GET'])
|
@app.route("/video/<file_name>", methods=['GET'])
|
||||||
def video_route(file_name):
|
def video_route(file_name):
|
||||||
reqfile = f'{rec_path}/thumb/{file_name}'
|
reqfile = f'{rec_path}/video/{file_name}'
|
||||||
if not os.path.exists(reqfile):
|
if not os.path.exists(reqfile):
|
||||||
abort(404)
|
abort(404)
|
||||||
return send_file(reqfile, mimetype='video/mp4')
|
return send_file(reqfile, mimetype='video/mp4')
|
||||||
|
@ -330,5 +331,13 @@ def img_route(file_name):
|
||||||
abort(404)
|
abort(404)
|
||||||
return send_file(reqfile, mimetype='image/png')
|
return send_file(reqfile, mimetype='image/png')
|
||||||
|
|
||||||
|
@app.route('/watch/<file_name>')
|
||||||
|
def watch_route(file_name):
|
||||||
|
reqfile = f'{rec_path}/video/{file_name}'
|
||||||
|
if not os.path.exists(reqfile):
|
||||||
|
abort(404)
|
||||||
|
video_url=f'https://{scheduler_hostname}/video/{file_name}'
|
||||||
|
return render_template('watch.html', video_url=video_url)
|
||||||
|
|
||||||
def create_app():
|
def create_app():
|
||||||
return app
|
return app
|
||||||
|
|
23
src/scheduler/templates/watch.html
Normal file
23
src/scheduler/templates/watch.html
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/plyr/dist/plyr.min.css">
|
||||||
|
<title>DeflaxTV VoD Player</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<video id="player" playsinline controls>
|
||||||
|
<source src="{{ video_url }}" type="video/mp4">
|
||||||
|
</video>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/plyr/dist/plyr.min.js" crossorigin="anonymous"></script>
|
||||||
|
<script>
|
||||||
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
const player = new Plyr('#player');
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in a new issue