Browse Source

Hide viewer stats when in offline mode. Closes #66

pull/80/head
Gabe Kangas 5 years ago
parent
commit
2ae227360a
  1. 6
      webroot/index.html
  2. 3
      webroot/js/app.js

6
webroot/index.html

@ -78,9 +78,9 @@
<section id="stream-info" aria-label="Stream status" v-cloak class="flex font-mono bg-gray-900 text-indigo-200 shadow-md border-b border-gray-100 border-solid"> <section id="stream-info" aria-label="Stream status" v-cloak class="flex font-mono bg-gray-900 text-indigo-200 shadow-md border-b border-gray-100 border-solid">
<span>{{ streamStatus }}</span> <span>{{ streamStatus }}</span>
<span>{{ viewerCount }} {{ 'viewer' | plural(viewerCount) }}.</span> <span v-if="isOnline">{{ viewerCount }} {{ 'viewer' | plural(viewerCount) }}.</span>
<span>Max {{ sessionMaxViewerCount }} {{ 'viewer' | plural(sessionMaxViewerCount) }}.</span> <span v-if="isOnline">Max {{ sessionMaxViewerCount }} {{ 'viewer' | plural(sessionMaxViewerCount) }}.</span>
<span>{{ overallMaxViewerCount }} overall.</span> <span v-if="isOnline">{{ overallMaxViewerCount }} overall.</span>
</section> </section>
</main> </main>

3
webroot/js/app.js

@ -51,6 +51,7 @@ class Owncast {
sessionMaxViewerCount: 0, sessionMaxViewerCount: 0,
streamStatus: MESSAGE_OFFLINE, // Default state. streamStatus: MESSAGE_OFFLINE, // Default state.
viewerCount: 0, viewerCount: 0,
isOnline: false,
// from config // from config
appVersion: '', appVersion: '',
@ -281,6 +282,7 @@ class Owncast {
// stop status timer and disable chat after some time. // stop status timer and disable chat after some time.
handleOfflineMode() { handleOfflineMode() {
this.vueApp.isOnline = false;
clearInterval(this.streamDurationTimer); clearInterval(this.streamDurationTimer);
this.vueApp.streamStatus = MESSAGE_OFFLINE; this.vueApp.streamStatus = MESSAGE_OFFLINE;
if (this.streamStatus) { if (this.streamStatus) {
@ -293,6 +295,7 @@ class Owncast {
// play video! // play video!
handleOnlineMode() { handleOnlineMode() {
this.vueApp.playerOn = true; this.vueApp.playerOn = true;
this.vueApp.isOnline = true;
this.vueApp.streamStatus = MESSAGE_ONLINE; this.vueApp.streamStatus = MESSAGE_ONLINE;
this.player.startPlayer(); this.player.startPlayer();

Loading…
Cancel
Save