From 89132d8ac84a2eba002369843f1695ef4fae804b Mon Sep 17 00:00:00 2001 From: vexorian Date: Sat, 5 Sep 2020 16:53:50 -0400 Subject: [PATCH] Play button in TV guide. --- src/video.js | 25 +++++++++++++++++++++++-- web/public/style.css | 7 +++++++ web/public/views/guide.html | 13 ++++++++++--- 3 files changed, 40 insertions(+), 5 deletions(-) diff --git a/src/video.js b/src/video.js index aab95ba..5e80f3d 100644 --- a/src/video.js +++ b/src/video.js @@ -329,8 +329,8 @@ function video( channelDB , db) { router.get('/m3u8', async (req, res) => { - res.type('application/vnd.apple.mpegurl') - + //res.type('application/vnd.apple.mpegurl') + res.type("application/x-mpegURL"); // Check if channel queried is valid if (typeof req.query.channel === 'undefined') { @@ -414,5 +414,26 @@ function video( channelDB , db) { res.send(data) }) + + router.get('/media-player/:number.m3u', async (req, res) => { + try { + let channelNum = parseInt(req.params.number, 10); + let channel = await channelCache.getChannelConfig(channelDB, channelNum ); + if (channel.length === 0) { + res.status(404).send("Channel not found."); + return; + } + res.type('video/x-mpegurl'); + let path ="video"; + if (req.query.fast==="1") { + path ="m3u8"; + } + res.status(200).send(`#EXTM3U\n${req.protocol}://${req.get('host')}/${path}?channel=${channelNum}\n\n`); + } catch(err) { + console.error(err); + res.status(500).send("There was an error."); + } + }); + return router } diff --git a/web/public/style.css b/web/public/style.css index a90e8f5..3f0c6a8 100644 --- a/web/public/style.css +++ b/web/public/style.css @@ -218,6 +218,13 @@ table.tvguide { background: #414141; } +.tvguide td .play-channel { + top:25%; + left:25%; + width:50%; + height:50% +} + .tv-guide-now { width:0.2em; height: 100%; diff --git a/web/public/views/guide.html b/web/public/views/guide.html index f6db06a..9954c65 100644 --- a/web/public/views/guide.html +++ b/web/public/views/guide.html @@ -26,12 +26,19 @@ - + -
{{channels[channelNumber].number}}
+
+ + + + + {{channels[channelNumber].number}} + +
- {{channels[channelNumber].name}} + {{channels[channelNumber].name}}