2017-09-19 21:53:27 +08:00
|
|
|
import { makeCall } from '/imports/ui/services/api';
|
2017-12-09 00:38:51 +08:00
|
|
|
import Users from '/imports/api/users';
|
2017-09-01 23:26:57 +08:00
|
|
|
|
2017-09-20 11:12:10 +08:00
|
|
|
const joinVideo = () => {
|
2018-01-08 12:44:42 +08:00
|
|
|
const joinVideoEvent = new Event('joinVideo');
|
2017-09-20 11:12:10 +08:00
|
|
|
document.dispatchEvent(joinVideoEvent);
|
2018-01-08 12:44:42 +08:00
|
|
|
};
|
2017-09-20 11:12:10 +08:00
|
|
|
|
|
|
|
const exitVideo = () => {
|
2018-01-08 12:44:42 +08:00
|
|
|
const exitVideoEvent = new Event('exitVideo');
|
2017-09-20 11:12:10 +08:00
|
|
|
document.dispatchEvent(exitVideoEvent);
|
2018-01-08 12:44:42 +08:00
|
|
|
};
|
2017-09-20 11:12:10 +08:00
|
|
|
|
2017-09-19 21:53:27 +08:00
|
|
|
const sendUserShareWebcam = (stream) => {
|
|
|
|
makeCall('userShareWebcam', stream);
|
2017-09-01 23:26:57 +08:00
|
|
|
};
|
|
|
|
|
2017-09-19 21:53:27 +08:00
|
|
|
const sendUserUnshareWebcam = (stream) => {
|
|
|
|
makeCall('userUnshareWebcam', stream);
|
2017-09-01 23:26:57 +08:00
|
|
|
};
|
|
|
|
|
2018-01-08 12:44:42 +08:00
|
|
|
const getAllUsers = () => Users.find().fetch();
|
2017-12-09 00:38:51 +08:00
|
|
|
|
2017-09-01 23:26:57 +08:00
|
|
|
export default {
|
2017-12-09 00:38:51 +08:00
|
|
|
sendUserShareWebcam, sendUserUnshareWebcam, joinVideo, exitVideo, getAllUsers,
|
2017-09-01 23:26:57 +08:00
|
|
|
};
|