Commit 1c03cb8a authored by Stu Fisher's avatar Stu Fisher
Browse files

serve simple client from root

parent fb37cf05
Pipeline #33187 passed with stages
in 1 minute and 1 second
......@@ -3,6 +3,7 @@ pytest
pytest-cov
pytest-runner
gevent-websocket
flask
ffmpeg-python
ffmpeg
pytango
......@@ -5,11 +5,13 @@
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function(){
this.mplayer = new JSMpeg.Player('ws://localhost:5000/video', {
var uri = location.protocol === 'https:' ? 'wss:' : 'ws:';
var url = uri+'//'+location.host+'/video'
var mplayer = new JSMpeg.Player(url, {
canvas: document.getElementsByClassName('video-canvas')[0],
audio: false,
protocols: [],
})
});
}, false);
</script>
......
......@@ -13,6 +13,7 @@ from geventwebsocket import (
WebSocketApplication,
Resource,
)
from flask import Flask, send_file
from .lima import LimaCamera
from . import __version__
......@@ -24,6 +25,19 @@ logger = logging.getLogger(__name__)
cameras = {"lima": LimaCamera}
flask_app = Flask(__name__)
@flask_app.route("/")
def index():
return send_file("../scripts/client.html")
@flask_app.route("/jsmpeg.min.js")
def jsmpeg():
return send_file("../scripts/jsmpeg.min.js")
def start_ffmpeg(size, format):
job = (
ffmpeg.input(
......@@ -109,7 +123,7 @@ def main():
server = WebSocketServer(
(args.bind, args.port),
Resource([("^/video", Streamer)]),
Resource([("^/video", Streamer), ("^/.*", flask_app)]),
debug=False,
**server_args,
)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment