debug membershipEvents / soundRecorder

master
adb 4 years ago
parent 18bb86a7a9
commit eb259bbdae

@ -52,11 +52,15 @@ export default {
invite(event){ return `invited ${event.target?calcUserName(event.target.userId):event.content.displayname||event.state_key}` }, invite(event){ return `invited ${event.target?calcUserName(event.target.userId):event.content.displayname||event.state_key}` },
join(event){ join(event){
if (!event.unsigned.prev_content) return 'joined the room'; if (!event.unsigned.prev_content) return 'joined the room';
if (event.unsigned.prev_content.displayName !== event.content.displayname) if (event.unsigned.prev_content.membership === 'invite') return 'accepted invite';
if (event.unsigned.prev_content.displayname !== event.content.displayname)
return `changed displayname from ${event.unsigned.prev_content.displayname} to ${event.content.displayname}`; return `changed displayname from ${event.unsigned.prev_content.displayname} to ${event.content.displayname}`;
return 'updated their account'; return 'updated their account';
}, },
leave(){ return 'left the room' }, leave(event){
if (event.unsigned.prev_content && event.unsigned.prev_content.membership === 'invite') return 'rejected invite';
return 'left the room'
},
ban(event){return `banned ${calcUserName(event.target.userId)}` } ban(event){return `banned ${calcUserName(event.target.userId)}` }
} }
} }

@ -46,6 +46,7 @@ export default {
this.onStart(); this.onStart();
navigator.mediaDevices.getUserMedia({audio: true}) navigator.mediaDevices.getUserMedia({audio: true})
.then(stream => { .then(stream => {
this.stream = stream;
this.recorder.init(stream); this.recorder.init(stream);
this.recorder.start().then(()=>this.isRecording=true); this.recorder.start().then(()=>this.isRecording=true);
}) })
@ -56,6 +57,7 @@ export default {
.then(({blob}) => { .then(({blob}) => {
blob.name = `Recording-${new Date().toISOString()}.${blob.type.split('/')[1]}`; blob.name = `Recording-${new Date().toISOString()}.${blob.type.split('/')[1]}`;
this.onStop({blob}); this.onStop({blob});
this.stream.getTracks().map(track => track.stop());
this.isRecording=false; this.isRecording=false;
}); });
}, },
@ -68,8 +70,11 @@ export default {
data(){ data(){
return{ return{
recorder: new Recorder(audioContext, { recorder: new Recorder(audioContext, {
onAnalysed: data => this.setVoiceMeter(data.lineTo) onAnalysed: data => {
this.setVoiceMeter(data.lineTo);
}
}), }),
stream: undefined,
isRecording: false isRecording: false
} }
} }

Loading…
Cancel
Save