Make chat properly sized where before video would shrink it below desired 400px width

master
Thomas Lynch 2 years ago
parent 9485eeecd8
commit 391c8deedc
No known key found for this signature in database
GPG Key ID: FBAB081F9B6E14B2
  1. 32
      nginx/www/stream/dash.html
  2. 32
      nginx/www/stream/hls.html
  3. 506
      nginx/www/stream/stat.xsl
  4. 1
      nginx/www/stream/viewers.html
  5. 14
      viewers.sh

@ -10,15 +10,20 @@
:root{--text-color:#c5c8c6;--bg-color:black}
html{overflow:hidden;}
body{overflow:hidden;display:flex;flex-direction:column;background-color:var(--bg-color);color:var(--text-color);font-family:Arial,Helvetica,sans-serif;text-align:center;height: 100vh;margin: 0;padding: 0;}
body::before{ position: absolute; width: 100%; height: 100%; content: ""; z-index:-1; background: radial-gradient(circle at center,#1bd459 0,rgba(27,212,89,.88) 58%,rgba(21,235,92,.57) 80%,rgba(19,94,29,.27) 93%,rgba(10,23,12,0) 100%); opacity:.2;}
body::before{ position: absolute; width: 100%; height: 100%; content: ""; z-index:-1; background: radial-gradient(cse at center,#1bd459 0,rgba(27,212,89,.88) 58%,rgba(21,235,92,.57) 80%,rgba(19,94,29,.27) 93%,rgba(10,23,12,0) 100%); opacity:.2;}
body::after{ position: absolute; width: 100%; height: 100%; content: ""; z-index:-1; background: linear-gradient(180deg,hsla(0,0%,100%,0),hsla(0,0%,100%,0) 50%,rgba(0,0,0,.2) 70%,rgba(0,0,0,.6)); background-size: 100% .3rem; opacity:.5;}
.main{width:100%;height:100%;display:flex;align-items:center;max-height: calc(100vh - 100px);}
#footer{margin-top:auto;padding:10px;width:100%;margin-bottom:auto;}
video{max-width:100%;max-height:100%;display:flex;margin:0 auto;}
#footer{word-break: break-word;margin-top:auto;padding:10px;margin-bottom:auto;width:calc(100vw - 400px);}
video, #video{max-width:100%;max-height:100%;display:flex;margin:0 auto;width:calc(100% - 400px); height: 100%;}
a,a:visited {color:unset;}
#chat{width: 400px;height: 100vh;align-self: start;}
@media only screen and (max-width:600px) {
.main{flex-direction: column;}
#chat{width: 100%;max-width: 100%;}
.main{flex-direction: column;max-height: 100%;}
#video{width: 100%;height: 40vh;max-height: 40vh!important;}
body::before{width: calc(100% - 20px); height: calc(100% - 20px);}
body::after{width: calc(100% - 20px); height: calc(100% - 20px);}
#footer{display: none;}
}
</style>
</head>
@ -29,23 +34,34 @@ a,a:visited {color:unset;}
class="video-js vjs-default-skin"
controls
preload="auto"
style="max-width:100%;max-height:100%;display: flex;margin: 0 auto;width: 100%;height: 100%;"
style=""
data-setup='{}'>
</video>
<iframe id="chat"
title="irc"
frameBorder="0"
src="https://irc.fatpeople.lol/#@tom">
</iframe>
</div>
<div id="footer">
<div>
<a href='/hls.html'>HLS</a> (<a href='/hls/tom.m3u8'>m3u8</a>) / <b><a href='/dash.html'>DASH</a></b> (<a href='/dash/tom.mpd'>mpd</a>) / <a href='rtmp://stream.loki/live/tom'>RTMP</a>
<a href='/hls.html'>HLS</a> (<a href='/hls/tom.m3u8'>m3u8</a>) / <b><a href='/dash.html'>DASH</a></b> (<a href='/dash/tom.mpd'>mpd</a>) / <a href='rtmp://stream.loki/live/tom'>RTMP</a> - <a href='/streams'>Browse Streams</a>
</div>
<br>
<div>
<a href='/stat.html'>Stream List</a>
Want your own stream key? Ask ONS "fatchan" on Session.
</div>
<small>
<code>LBjExqjDKCFT6Tj198CfK8auAzBERJX1ogtcsjuKZ6AYWTFxwEADLgf2zZ8NHvWCa1UW7vrtY8DJmPYFpj3MEE69CryCvN6</code>
</small>
</div>
<script>
const source = window.location.search.substr(1) || 'tom';
const chat = document.getElementById('chat');
chat.src = chat.src.replace('@tom', `@${source}`);
document
.getElementById('footer')
.querySelectorAll('a')
.querySelectorAll('div:first-of-type a:not(:last-child)')
.forEach(a => {
if (a.href.includes('/tom')) {
a.href = a.href

@ -10,15 +10,20 @@
:root{--text-color:#c5c8c6;--bg-color:black}
html{overflow:hidden;}
body{overflow:hidden;display:flex;flex-direction:column;background-color:var(--bg-color);color:var(--text-color);font-family:Arial,Helvetica,sans-serif;text-align:center;height: 100vh;margin: 0;padding: 0;}
body::before{ position: absolute; width: 100%; height: 100%; content: ""; z-index:-1; background: radial-gradient(circle at center,#1bd459 0,rgba(27,212,89,.88) 58%,rgba(21,235,92,.57) 80%,rgba(19,94,29,.27) 93%,rgba(10,23,12,0) 100%); opacity:.2;}
body::before{ position: absolute; width: 100%; height: 100%; content: ""; z-index:-1; background: radial-gradient(cse at center,#1bd459 0,rgba(27,212,89,.88) 58%,rgba(21,235,92,.57) 80%,rgba(19,94,29,.27) 93%,rgba(10,23,12,0) 100%); opacity:.2;}
body::after{ position: absolute; width: 100%; height: 100%; content: ""; z-index:-1; background: linear-gradient(180deg,hsla(0,0%,100%,0),hsla(0,0%,100%,0) 50%,rgba(0,0,0,.2) 70%,rgba(0,0,0,.6)); background-size: 100% .3rem; opacity:.5;}
.main{width:100%;height:100%;display:flex;align-items:center;max-height: calc(100vh - 100px);}
#footer{margin-top:auto;padding:10px;width:100%;margin-bottom:auto;}
video{max-width:100%;max-height:100%;display:flex;margin:0 auto;}
#footer{word-break: break-word;margin-top:auto;padding:10px;margin-bottom:auto;width:calc(100vw - 400px);}
video, #video{max-width:100%;max-height:100%;display:flex;margin:0 auto;width:calc(100% - 400px); height: 100%;}
a,a:visited {color:unset;}
#chat{width: 400px;height: 100vh;align-self: start;}
@media only screen and (max-width:600px) {
.main{flex-direction: column;}
#chat{width: 100%;max-width: 100%;}
.main{flex-direction: column;max-height: 100%;}
#video{width: 100%;height: 40vh;max-height: 40vh!important;}
body::before{width: calc(100% - 20px); height: calc(100% - 20px);}
body::after{width: calc(100% - 20px); height: calc(100% - 20px);}
#footer{display: none;}
}
</style>
</head>
@ -29,23 +34,34 @@ a,a:visited {color:unset;}
class="video-js vjs-default-skin"
controls
preload="auto"
style="max-width:100%;max-height:100%;display: flex;margin: 0 auto;width: 100%;height: 100%;"
style=""
data-setup='{}'>
</video>
<iframe id="chat"
title="irc"
frameBorder="0"
src="https://irc.fatpeople.lol/#@tom">
</iframe>
</div>
<div id="footer">
<div>
<b><a href='/hls.html'>HLS</a></b> (<a href='/hls/tom.m3u8'>m3u8</a>) / <a href='/dash.html'>DASH</a> (<a href='/dash/tom.mpd'>mpd</a>) / <a href='rtmp://stream.loki/live/tom'>RTMP</a>
<b><a href='/hls.html'>HLS</a></b> (<a href='/hls/tom.m3u8'>m3u8</a>) / <a href='/dash.html'>DASH</a> (<a href='/dash/tom.mpd'>mpd</a>) / <a href='rtmp://stream.loki/live/tom'>RTMP</a> - <a href='/streams'>Browse Streams</a>
</div>
<br>
<div>
<a href='/stat.html'>Stream List</a>
Want your own stream key? Ask ONS "fatchan" on Session.
</div>
<small>
<code>LBjExqjDKCFT6Tj198CfK8auAzBERJX1ogtcsjuKZ6AYWTFxwEADLgf2zZ8NHvWCa1UW7vrtY8DJmPYFpj3MEE69CryCvN6</code>
</small>
</div>
<script>
const source = window.location.search.substr(1) || 'tom';
const chat = document.getElementById('chat');
chat.src = chat.src.replace('@tom', `@${source}`);
document
.getElementById('footer')
.querySelectorAll('a')
.querySelectorAll('div:first-of-type a:not(:last-child)')
.forEach(a => {
if (a.href.includes('/tom')) {
a.href = a.href

@ -10,330 +10,262 @@
<xsl:template match="/">
<html>
<head>
<title>RTMP statistics</title>
</head>
<body>
<xsl:apply-templates select="rtmp"/>
</body>
</html>
<html>
<head>
<title>Stream List</title>
<meta charset="utf-8"></meta>
<meta name="viewport" content="width=device-width initial-scale=1"></meta>
<style>
:root{--text-color:#c5c8c6;--bg-color:black}
html{overflow:hidden;}
body{overflow:hidden;display:flex;flex-direction:column;background-color:var(--bg-color);color:var(--text-color);font-family:Arial,Helvetica,sans-serif;text-align:center;height: 100vh;margin: 0;padding: 0;}
body::before{ position: absolute; width: 100%; height: 100%; content: ""; z-index:-1; background: radial-gradient(circle at center,#1bd459 0,rgba(27,212,89,.88) 58%,rgba(21,235,92,.57) 80%,rgba(19,94,29,.27) 93%,rgba(10,23,12,0) 100%); opacity:.2;}
body::after{ position: absolute; width: 100%; height: 100%; content: ""; z-index:-1; background: linear-gradient(180deg,hsla(0,0%,100%,0),hsla(0,0%,100%,0) 50%,rgba(0,0,0,.2) 70%,rgba(0,0,0,.6)); background-size: 100% .3rem; opacity:.5;}
.main{width:100%;height:100%;display:flex;align-items:center;max-height: calc(100vh - 100px);}
#footer{margin-top:auto;padding:10px;width:100%;margin-bottom:auto;}
video{max-width:100%;max-height:100%;display:flex;margin:0 auto;}
a,a:visited {color:unset;}
@media only screen and (max-width:600px) {
.main{flex-direction: column;}
#video{width: 100%;height: 40vh;max-height: 40vh!important;}
table td, table th {display:none}
table td:nth-child(1), table th:nth-child(1),
table td:nth-child(2), table th:nth-child(2),
table td:nth-child(3), table th:nth-child(3),
table td:nth-child(18), table th:nth-child(12) {display:unset;}
table tr:nth-of-type(2) {display:none;}
tr {display: flex; justify-content: space-between;}
}
</style>
</head>
<body>
<xsl:apply-templates select="rtmp"/>
</body>
</html>
</xsl:template>
<xsl:template match="rtmp">
<table cellspacing="1" cellpadding="5">
<tr bgcolor="#999999">
<th>RTMP</th>
<th>#clients</th>
<th colspan="4">Video</th>
<th colspan="4">Audio</th>
<th>In bytes</th>
<th>Out bytes</th>
<th>In bits/s</th>
<th>Out bits/s</th>
<th>State</th>
<th>Time</th>
</tr>
<tr>
<td colspan="2">Accepted: <xsl:value-of select="naccepted"/></td>
<th bgcolor="#999999">codec</th>
<th bgcolor="#999999">bits/s</th>
<th bgcolor="#999999">size</th>
<th bgcolor="#999999">fps</th>
<th bgcolor="#999999">codec</th>
<th bgcolor="#999999">bits/s</th>
<th bgcolor="#999999">freq</th>
<th bgcolor="#999999">chan</th>
<td>
<xsl:call-template name="showsize">
<xsl:with-param name="size" select="bytes_in"/>
</xsl:call-template>
</td>
<td>
<xsl:call-template name="showsize">
<xsl:with-param name="size" select="bytes_out"/>
</xsl:call-template>
</td>
<td>
<xsl:call-template name="showsize">
<xsl:with-param name="size" select="bw_in"/>
<xsl:with-param name="bits" select="1"/>
<xsl:with-param name="persec" select="1"/>
</xsl:call-template>
</td>
<td>
<xsl:call-template name="showsize">
<xsl:with-param name="size" select="bw_out"/>
<xsl:with-param name="bits" select="1"/>
<xsl:with-param name="persec" select="1"/>
</xsl:call-template>
</td>
<td/>
<td>
<xsl:call-template name="showtime">
<xsl:with-param name="time" select="/rtmp/uptime * 1000"/>
</xsl:call-template>
</td>
</tr>
<xsl:apply-templates select="server"/>
</table>
<table cellspacing="1" cellpadding="5">
<tr>
<th>Name</th>
<th>Stream Page</th>
<th>Clients</th>
<th colspan="4">Video</th>
<th colspan="4">Audio</th>
<th>In bytes</th>
<th>Out bytes</th>
<th>In bits/s</th>
<th>Out bits/s</th>
<th>Dropped</th>
<th>State</th>
<th>Time</th>
</tr>
<tr id="2row">
<th></th>
<th></th>
<th></th>
<th>Codec</th>
<th>Bits/s</th>
<th>Size</th>
<th>FPS</th>
<th>Codec</th>
<th>Bits/s</th>
<th>Freq</th>
<th>Chan</th>
<td>
<xsl:call-template name="showsize">
<xsl:with-param name="size" select="bytes_in"/>
</xsl:call-template>
</td>
<td>
<xsl:call-template name="showsize">
<xsl:with-param name="size" select="bytes_out"/>
</xsl:call-template>
</td>
<td>
<xsl:call-template name="showsize">
<xsl:with-param name="size" select="bw_in"/>
<xsl:with-param name="bits" select="1"/>
<xsl:with-param name="persec" select="1"/>
</xsl:call-template>
</td>
<td>
<xsl:call-template name="showsize">
<xsl:with-param name="size" select="bw_out"/>
<xsl:with-param name="bits" select="1"/>
<xsl:with-param name="persec" select="1"/>
</xsl:call-template>
</td>
<td/>
<td/>
<td>
<xsl:call-template name="showtime">
<xsl:with-param name="time" select="/rtmp/uptime * 1000"/>
</xsl:call-template>
</td>
</tr>
<xsl:apply-templates select="server"/>
</table>
</xsl:template>
<xsl:template match="server">
<xsl:apply-templates select="application"/>
<xsl:apply-templates select="application"/>
</xsl:template>
<xsl:template match="application">
<tr bgcolor="#999999">
<td>
<b><xsl:value-of select="name"/></b>
</td>
</tr>
<xsl:apply-templates select="live"/>
<xsl:apply-templates select="play"/>
<xsl:apply-templates select="live"/>
<xsl:apply-templates select="play"/>
</xsl:template>
<xsl:template match="live">
<tr bgcolor="#aaaaaa">
<td>
<i>live streams</i>
</td>
<td align="middle">
<xsl:value-of select="nclients"/>
</td>
</tr>
<xsl:apply-templates select="stream"/>
</xsl:template>
<xsl:template match="play">
<tr bgcolor="#aaaaaa">
<td>
<i>vod streams</i>
</td>
<td align="middle">
<xsl:value-of select="nclients"/>
</td>
</tr>
<xsl:apply-templates select="stream"/>
<xsl:apply-templates select="stream"/>
</xsl:template>
<xsl:template match="stream">
<tr valign="top">
<xsl:attribute name="bgcolor">
<xsl:choose>
<xsl:when test="active">#cccccc</xsl:when>
<xsl:otherwise>#dddddd</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<td>
<a href="">
<xsl:attribute name="onclick">
var d=document.getElementById('<xsl:value-of select="../../name"/>-<xsl:value-of select="name"/>');
d.style.display=d.style.display=='none'?'':'none';
return false
</xsl:attribute>
<xsl:value-of select="name"/>
<xsl:if test="string-length(name) = 0">
[EMPTY]
</xsl:if>
</a>
</td>
<td align="middle"> <xsl:value-of select="nclients"/> </td>
<td>
<xsl:value-of select="meta/video/codec"/>&#160;<xsl:value-of select="meta/video/profile"/>&#160;<xsl:value-of select="meta/video/level"/>
</td>
<td>
<xsl:call-template name="showsize">
<xsl:with-param name="size" select="bw_video"/>
<xsl:with-param name="bits" select="1"/>
<xsl:with-param name="persec" select="1"/>
</xsl:call-template>
</td>
<td>
<xsl:apply-templates select="meta/video/width"/>
</td>
<td>
<xsl:value-of select="meta/video/frame_rate"/>
</td>
<td>
<xsl:value-of select="meta/audio/codec"/>&#160;<xsl:value-of select="meta/audio/profile"/>
</td>
<td>
<xsl:call-template name="showsize">
<xsl:with-param name="size" select="bw_audio"/>
<xsl:with-param name="bits" select="1"/>
<xsl:with-param name="persec" select="1"/>
</xsl:call-template>
</td>
<td>
<xsl:apply-templates select="meta/audio/sample_rate"/>
</td>
<td>
<xsl:value-of select="meta/audio/channels"/>
</td>
<td>
<xsl:call-template name="showsize">
<xsl:with-param name="size" select="bytes_in"/>
</xsl:call-template>
</td>
<td>
<xsl:call-template name="showsize">
<xsl:with-param name="size" select="bytes_out"/>
</xsl:call-template>
</td>
<td>
<xsl:call-template name="showsize">
<xsl:with-param name="size" select="bw_in"/>
<xsl:with-param name="bits" select="1"/>
<xsl:with-param name="persec" select="1"/>
</xsl:call-template>
</td>
<td>
<xsl:call-template name="showsize">
<xsl:with-param name="size" select="bw_out"/>
<xsl:with-param name="bits" select="1"/>
<xsl:with-param name="persec" select="1"/>
</xsl:call-template>
</td>
<td><xsl:call-template name="streamstate"/></td>
<td>
<xsl:call-template name="showtime">
<xsl:with-param name="time" select="time"/>
</xsl:call-template>
</td>
</tr>
<tr style="display:none">
<xsl:attribute name="id">
<xsl:value-of select="../../name"/>-<xsl:value-of select="name"/>
</xsl:attribute>
<td colspan="16" ngcolor="#eeeeee">
<table cellspacing="1" cellpadding="5">
<tr>
<th>Id</th>
<th>State</th>
<th>Address</th>
<th>Page URL</th>
<th>SWF URL</th>
<th>Dropped</th>
<th>Timestamp</th>
<th>A-V</th>
<th>Time</th>
</tr>
<xsl:apply-templates select="client"/>
</table>
</td>
</tr>
<tr valign="top">
<td>
<b><xsl:value-of select="name"/></b>
</td>
<td>
<a target="_blank">
<xsl:attribute name="href">
/hls.html?<xsl:value-of select="name"/>
</xsl:attribute>
/hls.html?<xsl:value-of select="name"/>
</a>
</td>
<td align="middle"> <xsl:value-of select="nclients"/> </td>
<td>
<xsl:value-of select="meta/video/codec"/>&#160;<xsl:value-of select="meta/video/profile"/>&#160;<xsl:value-of select="meta/video/level"/>
</td>
<td>
<xsl:call-template name="showsize">
<xsl:with-param name="size" select="bw_video"/>
<xsl:with-param name="bits" select="1"/>
<xsl:with-param name="persec" select="1"/>
</xsl:call-template>
</td>
<td>
<xsl:apply-templates select="meta/video/width"/>
</td>
<td>
<xsl:value-of select="meta/video/frame_rate"/>
</td>
<td>
<xsl:value-of select="meta/audio/codec"/>&#160;<xsl:value-of select="meta/audio/profile"/>
</td>
<td>
<xsl:call-template name="showsize">
<xsl:with-param name="size" select="bw_audio"/>
<xsl:with-param name="bits" select="1"/>
<xsl:with-param name="persec" select="1"/>
</xsl:call-template>
</td>
<td>
<xsl:apply-templates select="meta/audio/sample_rate"/>
</td>
<td>
<xsl:value-of select="meta/audio/channels"/>
</td>
<td>
<xsl:call-template name="showsize">
<xsl:with-param name="size" select="bytes_in"/>
</xsl:call-template>
</td>
<td>
<xsl:call-template name="showsize">
<xsl:with-param name="size" select="bytes_out"/>
</xsl:call-template>
</td>
<td>
<xsl:call-template name="showsize">
<xsl:with-param name="size" select="bw_in"/>
<xsl:with-param name="bits" select="1"/>
<xsl:with-param name="persec" select="1"/>
</xsl:call-template>
</td>
<td>
<xsl:call-template name="showsize">
<xsl:with-param name="size" select="bw_out"/>
<xsl:with-param name="bits" select="1"/>
<xsl:with-param name="persec" select="1"/>
</xsl:call-template>
</td>
<td><xsl:value-of select="client/dropped"/></td>
<td><xsl:call-template name="streamstate"/></td>
<td>
<xsl:call-template name="showtime">
<xsl:with-param name="time" select="time"/>
</xsl:call-template>
</td>
</tr>
</xsl:template>
<xsl:template name="showtime">
<xsl:param name="time"/>
<xsl:param name="time"/>
<xsl:if test="$time &gt; 0">
<xsl:variable name="sec">
<xsl:value-of select="floor($time div 1000)"/>
</xsl:variable>
<xsl:if test="$time &gt; 0">
<xsl:variable name="sec">
<xsl:value-of select="floor($time div 1000)"/>
</xsl:variable>
<xsl:if test="$sec &gt;= 86400">
<xsl:value-of select="floor($sec div 86400)"/>d
</xsl:if>
<xsl:if test="$sec &gt;= 86400">
<xsl:value-of select="floor($sec div 86400)"/>d
</xsl:if>
<xsl:if test="$sec &gt;= 3600">
<xsl:value-of select="(floor($sec div 3600)) mod 24"/>h
</xsl:if>
<xsl:if test="$sec &gt;= 3600">
<xsl:value-of select="(floor($sec div 3600)) mod 24"/>h
</xsl:if>
<xsl:if test="$sec &gt;= 60">
<xsl:value-of select="(floor($sec div 60)) mod 60"/>m
</xsl:if>
<xsl:if test="$sec &gt;= 60">
<xsl:value-of select="(floor($sec div 60)) mod 60"/>m
</xsl:if>
<xsl:value-of select="$sec mod 60"/>s
</xsl:if>
<xsl:value-of select="$sec mod 60"/>s
</xsl:if>
</xsl:template>
<xsl:template name="showsize">
<xsl:param name="size"/>
<xsl:param name="bits" select="0" />
<xsl:param name="persec" select="0" />
<xsl:variable name="sizen">
<xsl:value-of select="floor($size div 1024)"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$sizen &gt;= 1073741824">
<xsl:value-of select="format-number($sizen div 1073741824,'#.###')"/> T</xsl:when>
<xsl:param name="size"/>
<xsl:param name="bits" select="0" />
<xsl:param name="persec" select="0" />
<xsl:variable name="sizen">
<xsl:value-of select="floor($size div 1024)"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$sizen &gt;= 1073741824">
<xsl:value-of select="format-number($sizen div 1073741824,'#.###')"/> T</xsl:when>
<xsl:when test="$sizen &gt;= 1048576">
<xsl:value-of select="format-number($sizen div 1048576,'#.###')"/> G</xsl:when>
<xsl:when test="$sizen &gt;= 1048576">
<xsl:value-of select="format-number($sizen div 1048576,'#.###')"/> G</xsl:when>
<xsl:when test="$sizen &gt;= 1024">
<xsl:value-of select="format-number($sizen div 1024,'#.##')"/> M</xsl:when>
<xsl:when test="$sizen &gt;= 0">
<xsl:value-of select="$sizen"/> K</xsl:when>
</xsl:choose>
<xsl:if test="string-length($size) &gt; 0">
<xsl:choose>
<xsl:when test="$bits = 1">b</xsl:when>
<xsl:otherwise>B</xsl:otherwise>
</xsl:choose>
<xsl:if test="$persec = 1">/s</xsl:if>
</xsl:if>
<xsl:when test="$sizen &gt;= 1024">
<xsl:value-of select="format-number($sizen div 1024,'#.##')"/> M</xsl:when>
<xsl:when test="$sizen &gt;= 0">
<xsl:value-of select="$sizen"/> K</xsl:when>
</xsl:choose>
<xsl:if test="string-length($size) &gt; 0">
<xsl:choose>
<xsl:when test="$bits = 1">b</xsl:when>
<xsl:otherwise>B</xsl:otherwise>
</xsl:choose>
<xsl:if test="$persec = 1">/s</xsl:if>
</xsl:if>
</xsl:template>
<xsl:template name="streamstate">
<xsl:choose>
<xsl:when test="active">active</xsl:when>
<xsl:otherwise>idle</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="clientstate">
<xsl:choose>
<xsl:when test="publishing">publishing</xsl:when>
<xsl:otherwise>playing</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="client">
<tr>
<xsl:attribute name="bgcolor">
<xsl:choose>
<xsl:when test="publishing">#cccccc</xsl:when>
<xsl:otherwise>#eeeeee</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<td><xsl:value-of select="id"/></td>
<td><xsl:call-template name="clientstate"/></td>
<td><xsl:value-of select="address"/></td>
<td>
<a target="_blank">
<xsl:attribute name="href">
http://stream.loki/?<xsl:value-of select="../name"/>
</xsl:attribute>
http://stream.loki/?<xsl:value-of select="../name"/>
</a>
</td>
<td>rtmp://stream.loki/live/<xsl:value-of select="../name"/></td>
<td><xsl:value-of select="dropped"/></td>
<td><xsl:value-of select="timestamp"/></td>
<td><xsl:value-of select="avsync"/></td>
<td>
<xsl:call-template name="showtime">
<xsl:with-param name="time" select="time"/>
</xsl:call-template>
</td>
</tr>
</xsl:template>
<xsl:template match="publishing">
publishing
<xsl:choose>
<xsl:when test="active">active</xsl:when>
<xsl:otherwise>idle</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="active">
active
active
</xsl:template>
<xsl:template match="width">
<xsl:value-of select="."/>x<xsl:value-of select="../height"/>
<xsl:value-of select="."/>x<xsl:value-of select="../height"/>
</xsl:template>
</xsl:stylesheet>

@ -1 +0,0 @@
<!DOCTYPE html><html><body>👁 1</body></html>

@ -1,14 +0,0 @@
#!/bin/bash
timestamp_now=$(date +'%s')
timestamp_prev=$(date -d '1 min ago' +'%s')
lf_now=$(date +'%b %d %H:%M:' -d @$timestamp_now)
lf_prev=$(date +'%b %d %H:%M:' -d @$timestamp_prev)
viewers=`tail -n 10000 /var/log/haproxy.log \
| grep -E 'GET /(hls|dash)/' \
| grep -E "${lf_now}|${lf_prev}" \
| awk '{print $6}' \
| sort \
| uniq \
| wc -l`
echo "<!DOCTYPE html><html><body>👁 $viewers</body></html>" > /var/www/stream/viewers.html
Loading…
Cancel
Save