support for "ringing"

This commit is contained in:
or-else
2022-06-19 11:52:07 -07:00
parent cd6a87037d
commit 3eab7ec09b
5 changed files with 28 additions and 12 deletions
+11 -4
View File
@@ -13,6 +13,7 @@ const RING_SOUND = new Audio('audio/call-out.m4a');
RING_SOUND.loop = true;
const CALL_ENDED_SOUND = new Audio('audio/call-end.m4a');
CALL_ENDED_SOUND.loop = true;
const DIALING_SOUND = new Audio('audio/dialing.m4a');
const messages = defineMessages({
already_in_call: {
@@ -107,9 +108,6 @@ class CallPanel extends React.PureComponent {
case 'accept':
this.handleVideoCallAccepted(info);
break;
case 'offer':
this.handleVideoOfferMsg(info);
break;
case 'answer':
this.handleVideoAnswerMsg(info);
break;
@@ -119,6 +117,15 @@ class CallPanel extends React.PureComponent {
case 'hang-up':
this.handleRemoteHangup(info);
break;
case 'offer':
this.handleVideoOfferMsg(info);
break;
case 'ringing':
RING_SOUND.play();
break;
default:
console.warn("Unknown call event", info.event);
break;
}
}
@@ -141,7 +148,7 @@ class CallPanel extends React.PureComponent {
this.setState({localStream: stream, waitingForPeer: true});
this.localRef.current.srcObject = stream;
RING_SOUND.play();
DIALING_SOUND.play();
// Send call invitation.
this.props.onInvite(this.props.topic, this.props.seq, this.props.callState);