bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/actions-bar/mute-button/container.jsx

42 lines
1.0 KiB
React
Raw Normal View History

import React from 'react';
2017-04-29 04:01:02 +08:00
import { createContainer } from 'meteor/react-meteor-data';
import { makeCall } from '/imports/ui/services/api';
import Button from '/imports/ui/components/button/component';
2017-06-19 19:57:32 +08:00
import Users from '/imports/api/1.1/users/index';
import Auth from '/imports/ui/services/auth/index';
import MuteAudio from './component';
class MuteAudioContainer extends React.Component {
render() {
return (
<MuteAudio {...this.props} />
);
}
}
export default createContainer((params) => {
const userId = Auth.userID;
2017-06-03 03:25:02 +08:00
const user = Users.findOne({ userId }).user;
const isMuted = user.voiceUser.muted;
const isInAudio = user.voiceUser.joined;
const isTalking = user.voiceUser.talking;
2017-02-03 00:46:49 +08:00
2017-04-29 04:01:02 +08:00
let callback = () => { };
if (isInAudio && !isMuted) {
2017-04-26 21:47:44 +08:00
callback = () => makeCall('muteUser', userId);
}
if (isInAudio && isMuted) {
2017-04-26 21:47:44 +08:00
callback = () => makeCall('unmuteUser', userId);
}
const data = {
isInAudio,
isMuted,
callback,
isTalking,
};
return data;
}, MuteAudioContainer);