Created a helper and rewrote logic to determine if user is sharing audio/video

This commit is contained in:
perroned 2014-06-23 09:58:30 -07:00
parent 32ddd86438
commit 63a3a4c737
3 changed files with 16 additions and 10 deletions

View File

@ -10,7 +10,7 @@ Handlebars.registerHelper "getInSession", (k) -> Session.get k
@getCurrentUserFromSession = ->
id = Session.get("userId")
u = Meteor.Users.findOne("userId": id)
console.log Meteor.Users
#console.log Meteor.Users
u
# retrieve account for selected user
@ -38,4 +38,10 @@ Meteor.methods
sendMeetingInfoToClient: (meetingId, userId) ->
Session.set("userId", userId)
Session.set("meetingId", meetingId)
Handlebars.registerHelper "isUserSharingAudio", (u) ->
u.voiceUser.talking
Handlebars.registerHelper "isUserSharingVideo", (u) ->
u.webcam_stream.length isnt 0

View File

@ -33,13 +33,13 @@
{{> makeButton id=user.externUserId btn_class="chatBarIcon navbar-brand" i_class="comment" _id=_id}}
{{/if}}
{{#if user.sharingVideo}}
{{#if isUserSharingVideo user}}
{{> makeButton id=user.externUserId btn_class="navbarIconToggleActive videoFeedIcon navbar-brand" i_class="facetime-video" sharingVideo=true _id=_id}}
{{else}}
{{> makeButton id=user.externUserId btn_class="videoFeedIcon navbar-brand" i_class="stop" sharingVideo=false _id=_id}}
{{/if}}
{{#if user.sharingAudio}}
{{#if isUserSharingAudio user}}
{{> makeButton id=user.externUserId btn_class="navbarIconToggleActive audioFeedIcon navbar-brand" i_class="volume-up" sharingAudio=true _id=_id}}
{{else}}
{{> makeButton id=user.externUserId btn_class="audioFeedIcon navbar-brand" i_class="volume-off" sharingAudio=false _id=_id}}

View File

@ -37,14 +37,14 @@
<template name="displayOwnControls">
<!-- toggles for own user's mic and cam-->
<td>
{{#if user.sharingVideo}}
{{#if isUserSharingVideo user}}
{{> makeButton id=user.externUserId btn_class="disableCam btn-primary" i_class="facetime-video" _id=_id}}
{{else}}
{{> makeButton id=user.externUserId btn_class="enableCam btn-primary" i_class="stop" _id=_id}}
{{/if}}
</td>
<td>
{{#if user.sharingAudio}}
{{#if isUserSharingAudio user}}
{{> makeButton id=user.externUserId btn_class="disableMic btn-primary" i_class="bullhorn" _id=_id}}
{{else}}
{{> makeButton id=user.externUserId btn_class="enableMic btn-primary" i_class="volume-off" _id=_id}}
@ -59,13 +59,13 @@
{{#with getCurrentUser}}
<td>
{{#if this.user.permissions.disableCam}} <!-- if user viewing has ability to disable -->
{{#if ../../user.sharingVideo}}
{{#if isUserSharingVideo ../../user}}
{{> makeButton id=../../user.externUserId btn_class="disableCam btn-primary" i_class="facetime-video" _id=_id}}
{{else}}
{{> makeButton id=../../user.externUserId btn_class="enableCam btn-primary" i_class="stop" _id=_id}}
{{/if}}
{{else}}
{{#if ../../user.sharingVideo}}
{{#if isUserSharingVideo ../../user}}
{{> makeButton id=../../user.externUserId btn_class="disableCam btn-primary" i_class="facetime-video" _id=_id isDisabled="disabled"}}
{{else}}
{{> makeButton id=../../user.externUserId btn_class="enableCam btn-primary" i_class="stop" _id=_id isDisabled="disabled"}}
@ -74,13 +74,13 @@
</td>
<td>
{{#if this.user.permissions.disableMic}} <!-- if user viewing has ability to disable -->
{{#if ../../user.sharingAudio}}
{{#if isUserSharingAudio ../../user}}
{{> makeButton id=../../user.externUserId btn_class="disableMic btn-primary" i_class="bullhorn" _id=_id}}
{{else}}
{{> makeButton id=../../user.externUserId btn_class="enableMic btn-primary" i_class="volume-off" _id=_id}}
{{/if}}
{{else}}
{{#if ../../user.sharingAudio}}
{{#if isUserSharingAudio ../../user}}
{{> makeButton id=../../user.externUserId btn_class="disableMic btn-primary" i_class="bullhorn" _id=_id isDisabled="disabled"}}
{{else}}
{{> makeButton id=../../user.externUserId btn_class="enableMic btn-primary" i_class="volume-off" _id=_id isDisabled="disabled"}}