mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-18 17:33:59 +01:00
SYWEB-13 SYWEB-14: disabled "Call" button if the browser does not support all required WebRTC features
This commit is contained in:
parent
e9670fd144
commit
709b8ac2b7
3 changed files with 14 additions and 2 deletions
|
@ -40,6 +40,11 @@ window.RTCPeerConnection = window.RTCPeerConnection || window.webkitRTCPeerConne
|
||||||
window.RTCSessionDescription = window.RTCSessionDescription || window.webkitRTCSessionDescription || window.mozRTCSessionDescription;
|
window.RTCSessionDescription = window.RTCSessionDescription || window.webkitRTCSessionDescription || window.mozRTCSessionDescription;
|
||||||
window.RTCIceCandidate = window.RTCIceCandidate || window.webkitRTCIceCandidate || window.mozRTCIceCandidate;
|
window.RTCIceCandidate = window.RTCIceCandidate || window.webkitRTCIceCandidate || window.mozRTCIceCandidate;
|
||||||
|
|
||||||
|
// Returns true if the browser supports all required features to make WebRTC call
|
||||||
|
var isWebRTCSupported = function () {
|
||||||
|
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) {
|
||||||
var MatrixCall = function(room_id) {
|
var MatrixCall = function(room_id) {
|
||||||
|
|
|
@ -33,7 +33,8 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
|
||||||
paginating: false, // used to avoid concurrent pagination requests pulling in dup contents
|
paginating: false, // used to avoid concurrent pagination requests pulling in dup contents
|
||||||
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;
|
||||||
|
|
|
@ -176,7 +176,13 @@
|
||||||
<button ng-click="inviteUser()" ng-disabled="state.permission_denied">Invite</button>
|
<button ng-click="inviteUser()" ng-disabled="state.permission_denied">Invite</button>
|
||||||
</span>
|
</span>
|
||||||
<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()" ng-show="(currentCall == undefined || currentCall.state == 'ended') && memberCount() == 2" ng-disabled="state.permission_denied">Voice Call</button>
|
<button ng-click="startVoiceCall()"
|
||||||
|
ng-show="(currentCall == undefined || currentCall.state == 'ended') && memberCount() == 2"
|
||||||
|
ng-disabled="state.permission_denied || !state.webRTCSupported"
|
||||||
|
title ="{{ state.webRTCNotSupported ? '' : 'VoIP requires webRTC but your browser does not support it.'}}"
|
||||||
|
>
|
||||||
|
Voice Call
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ feedback }}
|
{{ feedback }}
|
||||||
|
|
Loading…
Reference in a new issue