Skip to content

Commit

Permalink
fixes #2356
Browse files Browse the repository at this point in the history
  • Loading branch information
night committed Apr 30, 2017
1 parent 434c589 commit 2aab9f9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/modules/video_player/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ class VideoPlayerModule {

viewerCount() {
try {
const controller = window.App && window.App.__container__.lookup('controller:channel');
if (!controller || !controller.model || $('.player-viewer-count').length) return;
const player = window.App && window.App.__container__.lookup('service:persistent-player');
if (!player || !player.playerComponent || $('.player-viewer-count').length) return;

$('div.player-streamstatus').append('<span class="player-viewer-count"></span>');
controller.model.addObserver('stream.viewers', (model, key) => {
player.playerComponent.addObserver('channel.stream.viewers', (model, key) => {
const viewers = model.get(key);
if (!viewers) return;
$('.player-viewer-count').text(`${Number(viewers).toLocaleString()} viewers`);
Expand Down

0 comments on commit 2aab9f9

Please sign in to comment.