|
@@ -43,10 +43,6 @@ class JitsiMediaDevices {
|
43
|
43
|
|
44
|
44
|
// Test if the W3C Permissions API is implemented and the 'camera' and 'microphone' permissions are
|
45
|
45
|
// implemented. If supported add onchange listeners.
|
46
|
|
- //
|
47
|
|
- // NOTE: We don't cache the result for the query because this can potentialy lead to outdated result returned
|
48
|
|
- // from isDevicePermissionGranted method ( for the time period before the first GUM has been resolved) if the
|
49
|
|
- // onchange handler is not working.
|
50
|
46
|
this._permissionsApiSupported = new Promise(resolve => {
|
51
|
47
|
if (!navigator.permissions) {
|
52
|
48
|
resolve(false);
|
|
@@ -60,6 +56,9 @@ class JitsiMediaDevices {
|
60
|
56
|
|
61
|
57
|
promises.push(navigator.permissions.query({ name: VIDEO_PERMISSION_NAME })
|
62
|
58
|
.then(status => {
|
|
59
|
+ this._handlePermissionsChange({
|
|
60
|
+ [MediaType.VIDEO]: this._parsePermissionState(status)
|
|
61
|
+ });
|
63
|
62
|
status.onchange = function() {
|
64
|
63
|
try {
|
65
|
64
|
self._handlePermissionsChange({
|
|
@@ -76,6 +75,9 @@ class JitsiMediaDevices {
|
76
|
75
|
|
77
|
76
|
promises.push(navigator.permissions.query({ name: AUDIO_PERMISSION_NAME })
|
78
|
77
|
.then(status => {
|
|
78
|
+ this._handlePermissionsChange({
|
|
79
|
+ [MediaType.AUDIO]: this._parsePermissionState(status)
|
|
80
|
+ });
|
79
|
81
|
status.onchange = function() {
|
80
|
82
|
try {
|
81
|
83
|
self._handlePermissionsChange({
|
|
@@ -195,10 +197,6 @@ class JitsiMediaDevices {
|
195
|
197
|
* @param {'audio'|'video'} [type] - type of devices to check,
|
196
|
198
|
* undefined stands for both 'audio' and 'video' together
|
197
|
199
|
* @returns {Promise<boolean>}
|
198
|
|
- *
|
199
|
|
- * NOTE: We don't cache the result from the query because this can potentialy lead to outdated result returned
|
200
|
|
- * from this method ( for the time period before the first GUM has been resolved) if the onchange handler is not
|
201
|
|
- * working.
|
202
|
200
|
*/
|
203
|
201
|
isDevicePermissionGranted(type) {
|
204
|
202
|
return new Promise(resolve => {
|