fix(remote-control): do not assume failed query is missing support
Multiple requests for checkUserRemoteControlSupport can be in flight simultaneously. Order of promise resolution is not guaranteed. It is possible for Request A and Request B to be in flight and then Request B's promise chain resolves first. Request A could have encountered errors and then resolve. Then what could happen is checkUserRemoteControlSupport returns true for remote control support due to Request B and the UI updates. But then checkUserRemoteControlSupport returns false for remote control support due to Request A's error and the UI updates to hide remote control.
This commit is contained in:
parent
5b25e02e26
commit
b86df7a8e3
|
@ -893,8 +893,10 @@ const VideoLayout = {
|
|||
* will be set.
|
||||
*/
|
||||
_setRemoteControlProperties(user, remoteVideo) {
|
||||
APP.remoteControl.checkUserRemoteControlSupport(user).then(result =>
|
||||
remoteVideo.setRemoteControlSupport(result));
|
||||
APP.remoteControl.checkUserRemoteControlSupport(user)
|
||||
.then(result => remoteVideo.setRemoteControlSupport(result))
|
||||
.catch(error =>
|
||||
logger.warn('could not get remote control properties', error));
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -91,9 +91,8 @@ class RemoteControl extends EventEmitter {
|
|||
* the user supports remote control and with false if not.
|
||||
*/
|
||||
checkUserRemoteControlSupport(user: Object) {
|
||||
return user.getFeatures().then(
|
||||
features => features.has(DISCO_REMOTE_CONTROL_FEATURE),
|
||||
() => false);
|
||||
return user.getFeatures()
|
||||
.then(features => features.has(DISCO_REMOTE_CONTROL_FEATURE));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue