beginning work on html5 audio

This commit is contained in:
Matthew Marangoni 2016-10-24 09:01:50 -07:00
parent 28af2439d1
commit 374698c338
7 changed files with 81 additions and 8 deletions

View File

@ -0,0 +1,31 @@
import { publish } from '/imports/api/common/server/helpers';
import { isAllowedTo } from '/imports/startup/server/userPermissions';
import { appendMessageHeader } from '/imports/api/common/server/helpers';
import Polls from '/imports/api/polls';
import { logger } from '/imports/startup/server/logger';
Meteor.methods({
getStun(credentials) { //TODO discuss location
const REDIS_CONFIG = Meteor.settings.redis;
// if (isAllowedTo('subscribePoll', credentials)) {
const { meetingId, requesterUserId, requesterToken } = credentials;
const eventName = 'send_stun_turn_info_request_message';
// if ((meetingId != null) &&
// (result.meetingId != null) &&
// (requesterUserId != null) &&
// (pollAnswerId != null)) {
let message = {
payload: {
meeting_id: meetingId,
requester_id: requesterUserId,
},
};
message = appendMessageHeader(eventName, message);
console.log('\n get stun \n');
return publish(REDIS_CONFIG.channels.fromBBBApps, message);
// }
// }
},
});

View File

@ -1,6 +1,11 @@
import { eventEmitter } from '/imports/startup/server';
import { updateVoiceUser } from '/imports/api/users/server/modifiers/updateVoiceUser';
eventEmitter.on('send_stun_turn_info_reply_message', function (arg) {
// handleVoiceEvent(arg);
console.log('\n\n\n handling stun reply \n\n\n');
});
eventEmitter.on('user_left_voice_message', function (arg) {
handleVoiceEvent(arg);
});

View File

@ -152,4 +152,5 @@ const handledMessageTypes = [
'send_caption_history_reply_message',
'edit_caption_history_message',
'update_caption_owner_message',
'send_stun_turn_info_request_message',
];

View File

@ -1,8 +1,10 @@
import React from 'react';
import Button from '/imports/ui/components/button/component';
import { clearModal } from '/imports/ui/components/app/service';
import { joinListenOnly, joinMicrophone, exitAudio } from '/imports/api/phone';
import classNames from 'classnames';
import ReactDOM from 'react-dom';
import { callServer } from '/imports/ui/services/api';
import styles from '../styles.scss';
export default class AudioSettings extends React.Component {
@ -10,6 +12,7 @@ export default class AudioSettings extends React.Component {
super(props);
this.chooseAudio = this.chooseAudio.bind(this);
this.joinAudio = this.joinAudio.bind(this);
}
handleClick() {
@ -20,6 +23,11 @@ export default class AudioSettings extends React.Component {
this.props.changeMenu(this.props.JOIN_AUDIO);
}
joinAudio() {
// joinMicrophone();
callServer('getStun');
}
render() {
return (
@ -28,8 +36,9 @@ export default class AudioSettings extends React.Component {
<Button className={styles.backBtn}
label={'Back'}
icon={'left-arrow'}
size={'sm'}
hideLabel={false}
size={'md'}
color={'primary'}
ghost={true}
onClick={this.chooseAudio}
/>
<div>
@ -51,12 +60,14 @@ export default class AudioSettings extends React.Component {
<option value='2' disabled>2</option>
<option value='3' disabled>3</option>
</select><br />
<Button
<Button className={styles.playSound}
label={'Play sound'}
icon={'audio'}
size={'md'}
color={'primary'}
ghost={true}
onClick={this.handleClick}
/>
/><br />
</div>
<div className={styles.half}>
Please note, a dialog will appear in your browser,
@ -67,7 +78,8 @@ export default class AudioSettings extends React.Component {
<Button className={styles.enterBtn}
label={'Enter Session'}
size={'md'}
onClick={this.handleClick}
color={'primary'}
onClick={this.joinAudio}
/>
</div>
</div>

View File

@ -1,6 +1,7 @@
import React from 'react';
import Button from '/imports/ui/components/button/component';
import { clearModal } from '/imports/ui/components/app/service';
import { joinListenOnly } from '/imports/api/phone';
import classNames from 'classnames';
import ReactDOM from 'react-dom';
import styles from '../styles.scss';
@ -16,6 +17,10 @@ export default class ListenOnly extends React.Component {
this.props.changeMenu(this.props.JOIN_AUDIO);
}
joinListen() {
joinListenOnly();
}
render() {
return (
@ -24,8 +29,9 @@ export default class ListenOnly extends React.Component {
<Button className={styles.backBtn}
label={'Back'}
icon={'left-arrow'}
size={'sm'}
hideLabel={false}
size={'md'}
color={'primary'}
ghost={true}
onClick={this.chooseAudio}
/>
<div>
@ -33,7 +39,14 @@ export default class ListenOnly extends React.Component {
</div>
</div>
<div>
Content goes here
Content goes here<br /><br />
Volume Slider Here
<Button className={styles.enterBtn}
label={'Enter Session'}
size={'md'}
color={'primary'}
onClick={this.joinListen}
/>
</div>
</div>
);

View File

@ -59,10 +59,19 @@ Button.audioBtn:first-of-type {
position: absolute;
left: 10px;
top: 10px;
border: none;
box-shadow: none;
}
.playSound {
border: none;
box-shadow: none;
}
.enterBtn {
position: absolute;
bottom: 10px;
right: 10px;
border: none;
box-shadow: none;
}

View File

@ -75,6 +75,8 @@ import '/imports/api/users/server/modifiers/updateVoiceUser';
import '/imports/api/users/server/modifiers/userJoined';
import '/imports/api/users/server/modifiers/eventHandlers';
import '/imports/api/phone/server/methods/getStun';
import '/imports/startup/server/EventQueue';
import '/imports/api/common/server/helpers';
import '/imports/startup/server/logger';