mirror of
https://mau.dev/maunium/synapse.git
synced 2024-08-28 13:11:56 +00:00
Notify a callee that their browser doesn't support VoIP too.
SYWEB-14 #resolved
This commit is contained in:
parent
99b0c9900e
commit
648fd2a622
@ -42,11 +42,13 @@ window.RTCIceCandidate = window.RTCIceCandidate || window.webkitRTCIceCandidate
|
|||||||
|
|
||||||
// Returns true if the browser supports all required features to make WebRTC call
|
// Returns true if the browser supports all required features to make WebRTC call
|
||||||
var isWebRTCSupported = function () {
|
var isWebRTCSupported = function () {
|
||||||
return (navigator.getUserMedia || window.RTCPeerConnection || window.RTCSessionDescription || window.RTCIceCandidate);
|
return !!(navigator.getUserMedia || window.RTCPeerConnection || window.RTCSessionDescription || window.RTCIceCandidate);
|
||||||
};
|
};
|
||||||
|
|
||||||
angular.module('MatrixCall', [])
|
angular.module('MatrixCall', [])
|
||||||
.factory('MatrixCall', ['matrixService', 'matrixPhoneService', '$rootScope', '$timeout', function MatrixCallFactory(matrixService, matrixPhoneService, $rootScope, $timeout) {
|
.factory('MatrixCall', ['matrixService', 'matrixPhoneService', '$rootScope', '$timeout', function MatrixCallFactory(matrixService, matrixPhoneService, $rootScope, $timeout) {
|
||||||
|
$rootScope.isWebRTCSupported = isWebRTCSupported();
|
||||||
|
|
||||||
var MatrixCall = function(room_id) {
|
var MatrixCall = function(room_id) {
|
||||||
this.room_id = room_id;
|
this.room_id = room_id;
|
||||||
this.call_id = "c" + new Date().getTime();
|
this.call_id = "c" + new Date().getTime();
|
||||||
|
@ -59,6 +59,16 @@ angular.module('matrixPhoneService', [])
|
|||||||
|
|
||||||
var MatrixCall = $injector.get('MatrixCall');
|
var MatrixCall = $injector.get('MatrixCall');
|
||||||
var call = new MatrixCall(event.room_id);
|
var call = new MatrixCall(event.room_id);
|
||||||
|
|
||||||
|
if (!isWebRTCSupported()) {
|
||||||
|
console.log("Incoming call ID "+msg.call_id+" but this browser doesn't support WebRTC");
|
||||||
|
// don't hang up the call: there could be other clients connected that do support WebRTC and declining the
|
||||||
|
// the call on their behalf would be really annoying.
|
||||||
|
// instead, we broadcast a fake call event with a non-functional call object
|
||||||
|
$rootScope.$broadcast(matrixPhoneService.INCOMING_CALL_EVENT, call);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
call.call_id = msg.call_id;
|
call.call_id = msg.call_id;
|
||||||
call.initWithInvite(event);
|
call.initWithInvite(event);
|
||||||
matrixPhoneService.allCalls[call.call_id] = call;
|
matrixPhoneService.allCalls[call.call_id] = call;
|
||||||
|
@ -79,7 +79,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<span ng-show="currentCall.state == 'ringing'">
|
<span ng-show="currentCall.state == 'ringing'">
|
||||||
<button ng-click="answerCall()">Answer {{ currentCall.type }} call</button>
|
<button ng-click="answerCall()" ng-disabled="!isWebRTCSupported" title="{{isWebRTCSupported ? '' : 'Your browser does not support VoIP' }}">Answer {{ currentCall.type }} call</button>
|
||||||
<button ng-click="hangupCall()">Reject</button>
|
<button ng-click="hangupCall()">Reject</button>
|
||||||
</span>
|
</span>
|
||||||
<button ng-click="hangupCall()" ng-show="currentCall && currentCall.state != 'ringing' && currentCall.state != 'ended' && currentCall.state != 'fledgling'">Hang up</button>
|
<button ng-click="hangupCall()" ng-show="currentCall && currentCall.state != 'ringing' && currentCall.state != 'ended' && currentCall.state != 'fledgling'">Hang up</button>
|
||||||
|
@ -34,7 +34,6 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
|
|||||||
stream_failure: undefined, // the response when the stream fails
|
stream_failure: undefined, // the response when the stream fails
|
||||||
waiting_for_joined_event: false, // true when the join request is pending. Back to false once the corresponding m.room.member event is received
|
waiting_for_joined_event: false, // true when the join request is pending. Back to false once the corresponding m.room.member event is received
|
||||||
messages_visibility: "hidden", // In order to avoid flickering when scrolling down the message table at the page opening, delay the message table display
|
messages_visibility: "hidden", // In order to avoid flickering when scrolling down the message table at the page opening, delay the message table display
|
||||||
webRTCSupported: isWebRTCSupported() // true if the browser does not support WebRTC
|
|
||||||
};
|
};
|
||||||
$scope.members = {};
|
$scope.members = {};
|
||||||
$scope.autoCompleting = false;
|
$scope.autoCompleting = false;
|
||||||
|
@ -111,8 +111,8 @@
|
|||||||
ng-class="containsBingWord(msg.content.body) && msg.user_id != state.user_id ? msg.echo_msg_state + ' messageBing' : msg.echo_msg_state"
|
ng-class="containsBingWord(msg.content.body) && msg.user_id != state.user_id ? msg.echo_msg_state + ' messageBing' : msg.echo_msg_state"
|
||||||
ng-bind-html="((msg.content.msgtype === 'm.text') ? msg.content.body : '') | linky:'_blank'"/>
|
ng-bind-html="((msg.content.msgtype === 'm.text') ? msg.content.body : '') | linky:'_blank'"/>
|
||||||
|
|
||||||
<span ng-show='msg.type === "m.call.invite" && msg.user_id == state.user_id'>Outgoing Call</span>
|
<span ng-show='msg.type === "m.call.invite" && msg.user_id == state.user_id'>Outgoing Call{{ isWebRTCSupported ? '' : ' (But your browser does not support VoIP)' }}</span>
|
||||||
<span ng-show='msg.type === "m.call.invite" && msg.user_id != state.user_id'>Incoming Call</span>
|
<span ng-show='msg.type === "m.call.invite" && msg.user_id != state.user_id'>Incoming Call{{ isWebRTCSupported ? '' : ' (But your browser does not support VoIP)' }}</span>
|
||||||
|
|
||||||
<div ng-show='msg.content.msgtype === "m.image"'>
|
<div ng-show='msg.content.msgtype === "m.image"'>
|
||||||
<div ng-hide='msg.content.thumbnail_url' ng-style="msg.content.body.h && { 'height' : (msg.content.body.h < 320) ? msg.content.body.h : 320}">
|
<div ng-hide='msg.content.thumbnail_url' ng-style="msg.content.body.h && { 'height' : (msg.content.body.h < 320) ? msg.content.body.h : 320}">
|
||||||
@ -178,15 +178,15 @@
|
|||||||
<button ng-click="leaveRoom()" ng-disabled="state.permission_denied">Leave</button>
|
<button ng-click="leaveRoom()" ng-disabled="state.permission_denied">Leave</button>
|
||||||
<button ng-click="startVoiceCall()"
|
<button ng-click="startVoiceCall()"
|
||||||
ng-show="(currentCall == undefined || currentCall.state == 'ended')"
|
ng-show="(currentCall == undefined || currentCall.state == 'ended')"
|
||||||
ng-disabled="state.permission_denied || !state.webRTCSupported || memberCount() != 2"
|
ng-disabled="state.permission_denied || !isWebRTCSupported || memberCount() != 2"
|
||||||
title ="{{ !state.webRTCSupported ? 'VoIP requires webRTC but your browser does not support it' : (memberCount() == 2 ? '' : 'VoIP calls can only be made in rooms with two participants') }}"
|
title ="{{ !isWebRTCSupported ? 'VoIP requires webRTC but your browser does not support it' : (memberCount() == 2 ? '' : 'VoIP calls can only be made in rooms with two participants') }}"
|
||||||
>
|
>
|
||||||
Voice Call
|
Voice Call
|
||||||
</button>
|
</button>
|
||||||
<button ng-click="startVideoCall()"
|
<button ng-click="startVideoCall()"
|
||||||
ng-show="(currentCall == undefined || currentCall.state == 'ended')"
|
ng-show="(currentCall == undefined || currentCall.state == 'ended')"
|
||||||
ng-disabled="state.permission_denied || !state.webRTCSupported || memberCount() != 2"
|
ng-disabled="state.permission_denied || !isWebRTCSupported || memberCount() != 2"
|
||||||
title ="{{ !state.webRTCSupported ? 'VoIP requires webRTC but your browser does not support it' : (memberCount() == 2 ? '' : 'VoIP calls can only be made in rooms with two participants') }}"
|
title ="{{ !isWebRTCSupported ? 'VoIP requires webRTC but your browser does not support it' : (memberCount() == 2 ? '' : 'VoIP calls can only be made in rooms with two participants') }}"
|
||||||
>
|
>
|
||||||
Video Call
|
Video Call
|
||||||
</button>
|
</button>
|
||||||
|
Loading…
Reference in New Issue
Block a user