v1.6.0/volume manager, styling fixes
This commit is contained in:
+3
-1
@@ -76,9 +76,11 @@ export const emptyLocalData = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const scrollThread = () => {
|
export const scrollThread = () => {
|
||||||
|
setTimeout(function () {
|
||||||
const pcc = document.querySelector('.thread-wrapper');
|
const pcc = document.querySelector('.thread-wrapper');
|
||||||
if (pcc) pcc.scrollTop = pcc.scrollHeight;
|
if (pcc) pcc.scrollTop = pcc.scrollHeight;
|
||||||
}
|
}, 500);
|
||||||
|
};
|
||||||
|
|
||||||
export const getUserUid = async () =>
|
export const getUserUid = async () =>
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
|
|||||||
+1
-12
@@ -105,7 +105,7 @@ export default class CallManager {
|
|||||||
const joined = await VoxeetSDK.conference
|
const joined = await VoxeetSDK.conference
|
||||||
.join(conference, { constraints: { audio: true, video: false } })
|
.join(conference, { constraints: { audio: true, video: false } })
|
||||||
.then(() => true)
|
.then(() => true)
|
||||||
.catch(e => {
|
.catch((e) => {
|
||||||
this.listener({ onCall: false, muted: false, callActionPending: false });
|
this.listener({ onCall: false, muted: false, callActionPending: false });
|
||||||
this.notify('Unable to join call. Try again in a moment.');
|
this.notify('Unable to join call. Try again in a moment.');
|
||||||
console.error('Error joining call', e);
|
console.error('Error joining call', e);
|
||||||
@@ -157,21 +157,10 @@ export default class CallManager {
|
|||||||
});
|
});
|
||||||
|
|
||||||
VoxeetSDK.conference.on('streamAdded', (participant, stream) => {
|
VoxeetSDK.conference.on('streamAdded', (participant, stream) => {
|
||||||
if (participant !== VoxeetSDK.session.participant) {
|
|
||||||
const voiceNode = document.createElement('video');
|
|
||||||
voiceNode.srcObject = stream;
|
|
||||||
voiceNode.id = participant.id;
|
|
||||||
voiceNode.width = 0;
|
|
||||||
voiceNode.height = 0;
|
|
||||||
voiceNode.autoplay = true;
|
|
||||||
voiceNode.classList.add('voxeetAudioOut');
|
|
||||||
document.body.appendChild(voiceNode);
|
|
||||||
}
|
|
||||||
this.listener({ callActionPending: false });
|
this.listener({ callActionPending: false });
|
||||||
});
|
});
|
||||||
|
|
||||||
VoxeetSDK.conference.on('streamRemoved', (participant, stream) => {
|
VoxeetSDK.conference.on('streamRemoved', (participant, stream) => {
|
||||||
if (document.getElementById(participant.id)) document.getElementById(participant.id).remove();
|
|
||||||
this.listener({ callActionPending: false });
|
this.listener({ callActionPending: false });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+40
-25
@@ -107,6 +107,7 @@ export default class Chat extends Component {
|
|||||||
LocalData().allowAutoRejoin !== undefined ? LocalData().allowAutoRejoin : true,
|
LocalData().allowAutoRejoin !== undefined ? LocalData().allowAutoRejoin : true,
|
||||||
replyTo: null,
|
replyTo: null,
|
||||||
sendingMessages: [],
|
sendingMessages: [],
|
||||||
|
volumes: {},
|
||||||
};
|
};
|
||||||
this.port = null;
|
this.port = null;
|
||||||
this.gifClick = this.gifClick.bind(this);
|
this.gifClick = this.gifClick.bind(this);
|
||||||
@@ -179,13 +180,20 @@ export default class Chat extends Component {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (response.messages) {
|
||||||
|
scrollThread();
|
||||||
|
}
|
||||||
|
|
||||||
// IF CHAT IS HIDDEN AND ALLOWS NOTIFICATION
|
// IF CHAT IS HIDDEN AND ALLOWS NOTIFICATION
|
||||||
if (!document.querySelector('body.visible') && this.state.allowChatNotification === true) {
|
if (!document.querySelector('body.visible') && this.state.allowChatNotification === true) {
|
||||||
if (response.messages && response.messages.length !== this.state.messages.length) {
|
if (response.messages && response.messages.length !== this.state.messages.length) {
|
||||||
scrollThread();
|
|
||||||
const lastMessage = response.messages[response.messages.length - 1];
|
const lastMessage = response.messages[response.messages.length - 1];
|
||||||
if (lastMessage.uid !== '<system>') {
|
if (lastMessage.uid !== '<system>') {
|
||||||
this.props.notify(`${lastMessage.name}${lastMessage.type === 'giphy' ? ' sent a gif.' : ': ' + lastMessage.text}`);
|
this.props.notify(
|
||||||
|
`${lastMessage.name}${
|
||||||
|
lastMessage.type === 'giphy' ? ' sent a gif.' : ': ' + lastMessage.text
|
||||||
|
}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -318,13 +326,13 @@ export default class Chat extends Component {
|
|||||||
uid: LocalData().userUid,
|
uid: LocalData().userUid,
|
||||||
text: message,
|
text: message,
|
||||||
time: new Date(),
|
time: new Date(),
|
||||||
type: ''
|
type: '',
|
||||||
};
|
};
|
||||||
if (this.state.gif === true) data.type = 'giphy';
|
if (this.state.gif === true) data.type = 'giphy';
|
||||||
if (this.state.replyTo !== null) data.replyTo = this.state.replyTo.id;
|
if (this.state.replyTo !== null) data.replyTo = this.state.replyTo.id;
|
||||||
sendingMessages.push(data);
|
sendingMessages.push(data);
|
||||||
this.setState({
|
this.setState({
|
||||||
sendingMessages
|
sendingMessages,
|
||||||
});
|
});
|
||||||
SendMessageApi(data)
|
SendMessageApi(data)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@@ -440,21 +448,17 @@ export default class Chat extends Component {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
getVideoVolume (id) {
|
|
||||||
console.log('GET VIDEO VOLUME FOR USER', id);
|
|
||||||
if (document.getElementById(id)) {
|
|
||||||
return document.getElementById(id).volume * 10;
|
|
||||||
} else {
|
|
||||||
console.log('VIDEO NOT FOUND FOR USER', id);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
setVideoVolume(v, id) {
|
setVideoVolume(v, id) {
|
||||||
console.log('SET VIDEO VOLUME FOR USER', v, id);
|
const audioOuts = document.querySelectorAll('audio.vxt-audio');
|
||||||
if (document.getElementById(id)) {
|
if (audioOuts.length > 0) {
|
||||||
return document.getElementById(id).volume = (v/10);
|
audioOuts.forEach((el) => {
|
||||||
} else {
|
if (el.id === `audio-${id}`) {
|
||||||
console.log('VIDEO NOT FOUND FOR USER', id);
|
el.volume = v * 0.1;
|
||||||
|
const { volumes } = this.state;
|
||||||
|
volumes[id] = v;
|
||||||
|
this.setState({ volumes });
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
@@ -476,7 +480,8 @@ export default class Chat extends Component {
|
|||||||
adminModeUpdate,
|
adminModeUpdate,
|
||||||
adminOnly,
|
adminOnly,
|
||||||
replyTo,
|
replyTo,
|
||||||
sendingMessages
|
sendingMessages,
|
||||||
|
volumes,
|
||||||
} = this.state;
|
} = this.state;
|
||||||
const alerts = [
|
const alerts = [
|
||||||
{
|
{
|
||||||
@@ -657,14 +662,22 @@ export default class Chat extends Component {
|
|||||||
{Object.keys(usersOnCall).map((id) => {
|
{Object.keys(usersOnCall).map((id) => {
|
||||||
return usersOnCall[id].status === 'Connected' ||
|
return usersOnCall[id].status === 'Connected' ||
|
||||||
usersOnCall[id].status === 'Connecting' ? (
|
usersOnCall[id].status === 'Connecting' ? (
|
||||||
<Tooltip interactive
|
<Tooltip
|
||||||
|
interactive
|
||||||
title={
|
title={
|
||||||
<Grid className="party-controls-users-volume" container spacing={2}>
|
<Grid className="party-controls-users-volume" container spacing={2}>
|
||||||
<Grid item>
|
<Grid item>
|
||||||
<VolumeDown />
|
<VolumeDown />
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs>
|
<Grid item xs>
|
||||||
<Slider max={10} min={0} step={1} color="secondary" value={this.getVideoVolume(id)} onChangeCommitted={(e,v) => this.setVideoVolume(v, id)} />
|
<Slider
|
||||||
|
max={10}
|
||||||
|
min={0}
|
||||||
|
step={1}
|
||||||
|
color="secondary"
|
||||||
|
value={volumes[id] || 10}
|
||||||
|
onChangeCommitted={(e, v) => this.setVideoVolume(v, id)}
|
||||||
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item>
|
<Grid item>
|
||||||
<VolumeUp />
|
<VolumeUp />
|
||||||
@@ -744,7 +757,11 @@ export default class Chat extends Component {
|
|||||||
} else return null;
|
} else return null;
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
<Thread setReplyTo={this.setReplyTo} sendingMessages={sendingMessages} sentMessages={messages} />
|
<Thread
|
||||||
|
setReplyTo={this.setReplyTo}
|
||||||
|
sendingMessages={sendingMessages}
|
||||||
|
sentMessages={messages}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Paper
|
<Paper
|
||||||
square
|
square
|
||||||
@@ -882,9 +899,7 @@ export default class Chat extends Component {
|
|||||||
<ReactGiphySearchbox
|
<ReactGiphySearchbox
|
||||||
apiKey="ojJbIMUN6XRMn4mHiFFav3rMCpXUg8sq"
|
apiKey="ojJbIMUN6XRMn4mHiFFav3rMCpXUg8sq"
|
||||||
onSelect={this.gifClick}
|
onSelect={this.gifClick}
|
||||||
masonryConfig={[
|
masonryConfig={[{ columns: 2, imageWidth: '50%', gutter: 5 }]}
|
||||||
{ columns: 2, imageWidth: '50%', gutter: 5 },
|
|
||||||
]}
|
|
||||||
searchFormClassName="giphy-search-form"
|
searchFormClassName="giphy-search-form"
|
||||||
wrapperClassName={`giphy-wrapper ${gif ? '' : 'giphy-wrapper-down'}`}
|
wrapperClassName={`giphy-wrapper ${gif ? '' : 'giphy-wrapper-down'}`}
|
||||||
listWrapperClassName="giphy-list-wrapper"
|
listWrapperClassName="giphy-list-wrapper"
|
||||||
|
|||||||
+3
-1
@@ -705,7 +705,8 @@ body.amazon-prime .notification-switch .MuiSwitch-thumb {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.giphy-wrapper.giphy-wrapper-down {
|
.giphy-wrapper.giphy-wrapper-down {
|
||||||
margin-bottom: -320px;
|
padding-top: 30px;
|
||||||
|
margin-bottom: -350px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.giphy-wrapper.giphy-wrapper-down .giphy-list-wrapper {
|
.giphy-wrapper.giphy-wrapper-down .giphy-list-wrapper {
|
||||||
@@ -713,6 +714,7 @@ body.amazon-prime .notification-switch .MuiSwitch-thumb {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.giphy-wrapper {
|
.giphy-wrapper {
|
||||||
|
padding-top: 0px;
|
||||||
transition: all ease-in-out 0.3s;
|
transition: all ease-in-out 0.3s;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user