Write parts of the client using the BBB api bridge methods
This commit is contained in:
parent
da1558c100
commit
ca8133070b
@ -23,6 +23,15 @@ https://github.com/bigbluebutton/bigbluebutton/blob/master/bigbluebutton-client/
|
||||
else
|
||||
res
|
||||
|
||||
###
|
||||
Queryies the user object via it's id
|
||||
###
|
||||
BBB.getUser = (_id) ->
|
||||
Meteor.Users.findOne({_id: _id})
|
||||
|
||||
BBB.getCurrentUser = () ->
|
||||
BBB.getUser(getInSession("DBID"))
|
||||
|
||||
###
|
||||
Query if the current user is sharing webcam.
|
||||
|
||||
@ -33,6 +42,7 @@ https://github.com/bigbluebutton/bigbluebutton/blob/master/bigbluebutton-client/
|
||||
for AM_I_SHARING_CAM_RESP (see below).
|
||||
###
|
||||
BBB.amISharingWebcam = (callback) ->
|
||||
BBB.isUserSharingWebcam BBB.getCurrentUser()?._id
|
||||
|
||||
###
|
||||
|
||||
@ -44,7 +54,20 @@ https://github.com/bigbluebutton/bigbluebutton/blob/master/bigbluebutton-client/
|
||||
if you want to be informed through an event. You have to register for
|
||||
IS_USER_PUBLISHING_CAM_RESP (see below).
|
||||
###
|
||||
BBB.isUserSharingWebcam = (userID, callback) ->
|
||||
BBB.isUserSharingWebcam = (_id, callback) ->
|
||||
BBB.getUser(_id)?.user?.webcam_stream?.length isnt 0
|
||||
|
||||
BBB.amITalking = (callback) ->
|
||||
BBB.isUserTalking BBB.getCurrentUser()?._id
|
||||
|
||||
BBB.isUserTalking = (_id, callback) ->
|
||||
BBB.getUser(_id)?.user?.voiceUser?.talking
|
||||
|
||||
BBB.amISharingAudio = (callback) ->
|
||||
BBB.isUserSharingAudio BBB.getCurrentUser()?._id
|
||||
|
||||
BBB.isUserSharingAudio = (_id) ->
|
||||
BBB.getUser(_id)?.user?.voiceUser?.joined
|
||||
|
||||
###
|
||||
Raise user's hand.
|
||||
@ -73,6 +96,7 @@ https://github.com/bigbluebutton/bigbluebutton/blob/master/bigbluebutton-client/
|
||||
for AM_I_PRESENTER_RESP (see below).
|
||||
###
|
||||
BBB.amIPresenter = (callback) ->
|
||||
returnOrCallback false, callback
|
||||
|
||||
###
|
||||
Eject a user.
|
||||
@ -97,6 +121,7 @@ https://github.com/bigbluebutton/bigbluebutton/blob/master/bigbluebutton-client/
|
||||
for GET_MY_ROLE_RESP (see below).
|
||||
###
|
||||
BBB.getMyRole = (callback) ->
|
||||
returnOrCallback "VIEWER", callback
|
||||
|
||||
###
|
||||
Query the current user's id.
|
||||
@ -107,13 +132,26 @@ https://github.com/bigbluebutton/bigbluebutton/blob/master/bigbluebutton-client/
|
||||
BBB.getMyUserID = (callback) ->
|
||||
returnOrCallback getInSession("userId"), callback
|
||||
|
||||
BBB.getMyUsername = (callback) ->
|
||||
returnOrCallback getInSession("userName"), callback
|
||||
BBB.getMyUserName = (callback) ->
|
||||
name = getInSession "userName" # check if we actually have one in the session
|
||||
|
||||
if name?
|
||||
name # great return it, no database query
|
||||
else # we need it from the database
|
||||
user = BBB.getCurrentUser()
|
||||
|
||||
if user?
|
||||
name = BBB.getUserName(user._id)
|
||||
setInSession "userName", name # store in session for fast access next time
|
||||
name
|
||||
|
||||
BBB.getMyVoiceBridge = (callback) ->
|
||||
res = Meteor.Meetings.findOne({}).voiceConf
|
||||
returnOrCallback res, callback
|
||||
|
||||
BBB.getUserName = (_id, callback) ->
|
||||
returnOrCallback BBB.getUser(_id)?.user?.name, callback
|
||||
|
||||
###
|
||||
Query the current user's role.
|
||||
Params:
|
||||
@ -123,10 +161,10 @@ https://github.com/bigbluebutton/bigbluebutton/blob/master/bigbluebutton-client/
|
||||
BBB.getMyUserInfo = (callback) ->
|
||||
result =
|
||||
myUserID: BBB.getMyUserID()
|
||||
myUsername: BBB.getMyUsername()
|
||||
myUsername: BBB.getMyUserName()
|
||||
myAvatarURL: null
|
||||
myRole: "VIEWER"
|
||||
amIPresenter: false
|
||||
myRole: BBB.getMyRole()
|
||||
amIPresenter: BBB.amIPresenter()
|
||||
voiceBridge: BBB.getMyVoiceBridge()
|
||||
dialNumber: null
|
||||
|
||||
@ -167,6 +205,18 @@ https://github.com/bigbluebutton/bigbluebutton/blob/master/bigbluebutton-client/
|
||||
###
|
||||
BBB.stopSharingCamera = ->
|
||||
|
||||
###
|
||||
Indicates if a user is muted
|
||||
###
|
||||
BBB.isUserMuted = (id) ->
|
||||
BBB.getUser(id)?.user?.voiceUser?.muted
|
||||
|
||||
###
|
||||
Indicates if the current user is muted
|
||||
###
|
||||
BBB.amIMuted = ->
|
||||
BBB.isUserMuted(BBB.getCurrentUser()._id)
|
||||
|
||||
###
|
||||
Mute the current user.
|
||||
###
|
||||
|
@ -4,9 +4,6 @@
|
||||
hex = "0" + hex while hex.length < 6
|
||||
"##{hex}"
|
||||
|
||||
@currentUserIsMuted = ->
|
||||
return Meteor.Users.findOne({_id: getInSession "DBID"})?.user?.voiceUser?.muted
|
||||
|
||||
# color can be a number (a hex converted to int) or a string (e.g. "#ffff00")
|
||||
@formatColor = (color) ->
|
||||
color ?= "0" # default value
|
||||
@ -48,16 +45,6 @@
|
||||
@getTimeOfJoining = ->
|
||||
Meteor.Users.findOne(_id: getInSession "DBID")?.user?.time_of_joining
|
||||
|
||||
@getUsersName = ->
|
||||
name = getInSession("userName") # check if we actually have one in the session
|
||||
if name? then name # great return it, no database query
|
||||
else # we need it from the database
|
||||
user = Meteor.Users.findOne({'_id': getInSession("DBID")})
|
||||
if user?.user?.name
|
||||
setInSession "userName", user.user.name # store in session for fast access next time
|
||||
user.user.name
|
||||
else null
|
||||
|
||||
@getPresentationFilename = ->
|
||||
currentPresentation = Meteor.Presentations.findOne({"presentation.current": true})
|
||||
currentPresentation?.presentation?.name
|
||||
@ -100,26 +87,23 @@ Handlebars.registerHelper "getWhiteboardTitle", ->
|
||||
"Whiteboard: " + getPresentationFilename()
|
||||
|
||||
Handlebars.registerHelper "isCurrentUser", (_id) ->
|
||||
_id is getInSession("DBID")
|
||||
_id is BBB.getCurrentUser()?._id
|
||||
|
||||
Handlebars.registerHelper "isCurrentUserMuted", ->
|
||||
return currentUserIsMuted()
|
||||
BBB.amIMuted()
|
||||
|
||||
Handlebars.registerHelper "isCurrentUserRaisingHand", ->
|
||||
user = Meteor.Users.findOne({_id:getInSession("DBID")})
|
||||
user = BBB.getCurrentUser()
|
||||
user?.user?.raise_hand
|
||||
|
||||
Handlebars.registerHelper "isCurrentUserSharingAudio", ->
|
||||
user = Meteor.Users.findOne({_id: getInSession("DBID")})
|
||||
return user?.user?.voiceUser?.joined
|
||||
BBB.amISharingAudio()
|
||||
|
||||
Handlebars.registerHelper "isCurrentUserSharingVideo", ->
|
||||
user = Meteor.Users.findOne({_id:getInSession("DBID")})
|
||||
user?.webcam_stream?.length isnt 0
|
||||
BBB.amISharingVideo()
|
||||
|
||||
Handlebars.registerHelper "isCurrentUserTalking", ->
|
||||
user = Meteor.Users.findOne({_id:getInSession("DBID")})
|
||||
return user?.user?.voiceUser?.talking
|
||||
BBB.amITalking()
|
||||
|
||||
Handlebars.registerHelper "isDisconnected", ->
|
||||
return !Meteor.status().connected
|
||||
@ -129,20 +113,16 @@ Handlebars.registerHelper "isUserListenOnly", (_id) ->
|
||||
return user?.user?.listenOnly
|
||||
|
||||
Handlebars.registerHelper "isUserMuted", (_id) ->
|
||||
user = Meteor.Users.findOne({_id:_id})
|
||||
return user?.user?.voiceUser?.muted
|
||||
BBB.isUserMuted(_id)
|
||||
|
||||
Handlebars.registerHelper "isUserSharingAudio", (_id) ->
|
||||
user = Meteor.Users.findOne({_id:_id})
|
||||
return user.user?.voiceUser?.joined
|
||||
BBB.isUserSharingAudio(_id)
|
||||
|
||||
Handlebars.registerHelper "isUserSharingVideo", (_id) ->
|
||||
user = Meteor.Users.findOne({_id:_id})
|
||||
return user.user?.webcam_stream?.length isnt 0
|
||||
BBB.isUserSharingWebcam(_id)
|
||||
|
||||
Handlebars.registerHelper "isUserTalking", (_id) ->
|
||||
user = Meteor.Users.findOne({_id:_id})
|
||||
return user?.user?.voiceUser?.talking
|
||||
BBB.isUserTalking(_id)
|
||||
|
||||
Handlebars.registerHelper "meetingIsRecording", ->
|
||||
Meteor.Meetings.findOne()?.recorded # Should only ever have one meeting, so we dont need any filter and can trust result #1
|
||||
|
@ -81,7 +81,7 @@ Handlebars.registerHelper "grabChatTabs", ->
|
||||
"message": message
|
||||
"chat_type": if chattingWith is "PUBLIC_CHAT" then "PUBLIC_CHAT" else "PRIVATE_CHAT"
|
||||
"from_userid": getInSession("DBID")
|
||||
"from_username": getUsersName()
|
||||
"from_username": BBB.getMyUserName()
|
||||
"from_tz_offset": "240"
|
||||
"to_username": if chattingWith is "PUBLIC_CHAT" then "public_chat_username" else dest.user.name
|
||||
"to_userid": if chattingWith is "PUBLIC_CHAT" then "public_chat_userid" else chattingWith
|
||||
|
Loading…
Reference in New Issue
Block a user