diff --git a/modules/admin.js b/modules/admin.js index 0deea15..2bbcb8a 100644 --- a/modules/admin.js +++ b/modules/admin.js @@ -223,8 +223,9 @@ class admin { }); socket.on('admin.dashboard.sync', function (data) { - syncDashboard(socket, 0); - updateDashboard(socket, data.displayId); + cli.error("admin.dashboard.sync is deprecated!"); + // syncDashboard(socket, 0); + // updateDashboard(socket, data.displayId); }); socket.on('admin.setDisplay', function (data) { diff --git a/public/js/dashboard.js b/public/js/dashboard.js index 7dcf871..799a404 100644 --- a/public/js/dashboard.js +++ b/public/js/dashboard.js @@ -1,12 +1,13 @@ var serverOptions; var bundleSettings; var bundleDirs; -var displayId = 0; var displayList; socket.on('connect', function () { - emit('admin.dashboard.sync'); + emit("admin.setDisplay", {display: displayId}); + var program = document.getElementById('program'); + program.src = "/display/" + displayId; }); socket.on("callback.update", function (data) { diff --git a/public/js/display.js b/public/js/display.js index 32d0e9e..d722efe 100644 --- a/public/js/display.js +++ b/public/js/display.js @@ -304,6 +304,7 @@ function checkStream(serverOptions) { }); try { flvPlayer.attachMediaElement(videoElement); + flvPlayer.volume = videoVolume; flvPlayer.load(); flvPlayer.play(); showBackgroundOnly(); diff --git a/public/js/displayLite.js b/public/js/displayLite.js index 9f68936..580c6fa 100644 --- a/public/js/displayLite.js +++ b/public/js/displayLite.js @@ -160,7 +160,7 @@ function nextSlide(data) { if (serverOptions.isAnnounce) { $("#" + getWebLayer()).addClass("fadeOut").removeClass("fadeIn"); $("#" + getWebLayer(1)).addClass("fadeOut").removeClass("fadeIn"); - setTimeout(function() { + setTimeout(function () { clearIFrame(getLayer()); clearIFrame(getLayer(1)); }, 1000); @@ -184,7 +184,7 @@ function nextSlide(data) { $(elem).show(); $("#" + getWebLayer()).addClass("fadeOut").removeClass("fadeIn"); $("#" + getWebLayer(1)).addClass("fadeOut").removeClass("fadeIn"); - setTimeout(function() { + setTimeout(function () { clearIFrame(getLayer()); clearIFrame(getLayer(1)); }, 1000); @@ -250,11 +250,16 @@ function checkStream(serverOptions) { if (flvjs.isSupported()) { var videoElement = document.getElementById('bgvid'); flvPlayer = flvjs.createPlayer({ - type: 'flv', - url: serverOptions.streamSource - }); + type: 'flv', + url: serverOptions.streamSource + }, { + enableStashBuffer: false, // enable for much longer buffer, note, video may stall if network jitter + isLive: true + } + ); try { flvPlayer.attachMediaElement(videoElement); + flvPlayer.volume = videoVolume; flvPlayer.load(); flvPlayer.play(); showBackgroundOnly(); diff --git a/routes/admin.js b/routes/admin.js index b0f7a02..6061ee0 100644 --- a/routes/admin.js +++ b/routes/admin.js @@ -9,7 +9,8 @@ let busboy = require("connect-busboy"); function ensureIsAdmin(req, res, next) { if (!req.isAuthenticated || !req.isAuthenticated()) { - req.session.location = "/admin"; + console.log(req.originalUrl); + req.session.location = req.originalUrl; return res.redirect("/login"); } else { if (!req.user.permissions.isAdmin) { @@ -27,15 +28,19 @@ module.exports = function (websocket, dispatcher) { router.use(busboy({immediate: true})); router.get('/', function (req, res, next) { - res.render('admin/dashboard', {config: config, permission: req.user.permissions}); + let displayId = req.query['displayId'] || 0; + res.render('admin/dashboard', {config: config, displayId: displayId, permission: req.user.permissions}); }); router.get('/preview', function (req, res, next) { let socketId = req.query['socket']; - let displayId = req.query['displayId'] || 0; + let displayId = parseInt(req.query['displayId']) || 0; res.render('preview', {config: config, socketId: socketId, displayId: displayId}); }); + router.get('/overview', function (req, res, next) { + res.render('admin/overview', {config: config}); + }); router.get('/edit/slide', function (req, res, next) { let bundle = req.query['bundle']; diff --git a/routes/index.js b/routes/index.js index 3176f03..6842131 100644 --- a/routes/index.js +++ b/routes/index.js @@ -7,7 +7,8 @@ const cli = require('../modules/cli.js'); function ensureIsAdmin(req, res, next) { if (!req.isAuthenticated || !req.isAuthenticated()) { - req.session.location = "/"; + console.log(req.originalUrl); + req.session.location = req.originalUrl; return res.redirect("/login"); } return next(); @@ -17,6 +18,7 @@ module.exports = function (websocket, dispatcher) { if (config.secureViews) { router.use(ensureIsAdmin); } + router.get('/', function (req, res, next) { res.header('Access-Control-Allow-Origin', '*'); res.render('index', {config: config}); @@ -25,13 +27,15 @@ module.exports = function (websocket, dispatcher) { router.get('/display/:id/lite', function (req, res, next) { res.header('Access-Control-Allow-Origin', '*'); let idx = parseInt(req.params.id); - res.render('liteDisplay', {config: config, display: availableDisplays[idx], displayId: idx}); + let volume = req.params.videoVolume || 1.; + res.render('liteDisplay', {config: config, display: availableDisplays[idx], displayId: idx, videoVolume: volume}); }); router.get('/display/:id', function (req, res, next) { res.header('Access-Control-Allow-Origin', '*'); let idx = parseInt(req.params.id); - res.render('display', {config: config, display: availableDisplays[idx], displayId: idx}); + let volume = req.params.videoVolume || 1.; + res.render('display', {config: config, display: availableDisplays[idx], displayId: idx, videoVolume: volume}); }); router.get('/images/:dir/:name', function (req, res, next) { diff --git a/views/admin/dashboard.twig b/views/admin/dashboard.twig index 4dd3bc9..4af13fa 100644 --- a/views/admin/dashboard.twig +++ b/views/admin/dashboard.twig @@ -168,6 +168,7 @@ {% endblock %} \ No newline at end of file diff --git a/views/admin/overview.twig b/views/admin/overview.twig new file mode 100644 index 0000000..fbbd41c --- /dev/null +++ b/views/admin/overview.twig @@ -0,0 +1,30 @@ +{% extends 'layout/admin.twig' %} + +{% block header %} + +{% endblock %} + + +{% block body %} +