瀏覽代碼

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.
master
Leonard Kim 5 年之前
父節點
當前提交
b86df7a8e3
共有 2 個檔案被更改,包括 6 行新增5 行删除
  1. 4
    2
      modules/UI/videolayout/VideoLayout.js
  2. 2
    3
      modules/remotecontrol/RemoteControl.js

+ 4
- 2
modules/UI/videolayout/VideoLayout.js 查看文件

893
      * will be set.
893
      * will be set.
894
      */
894
      */
895
     _setRemoteControlProperties(user, remoteVideo) {
895
     _setRemoteControlProperties(user, remoteVideo) {
896
-        APP.remoteControl.checkUserRemoteControlSupport(user).then(result =>
897
-            remoteVideo.setRemoteControlSupport(result));
896
+        APP.remoteControl.checkUserRemoteControlSupport(user)
897
+            .then(result => remoteVideo.setRemoteControlSupport(result))
898
+            .catch(error =>
899
+                logger.warn('could not get remote control properties', error));
898
     },
900
     },
899
 
901
 
900
     /**
902
     /**

+ 2
- 3
modules/remotecontrol/RemoteControl.js 查看文件

91
      * the user supports remote control and with false if not.
91
      * the user supports remote control and with false if not.
92
      */
92
      */
93
     checkUserRemoteControlSupport(user: Object) {
93
     checkUserRemoteControlSupport(user: Object) {
94
-        return user.getFeatures().then(
95
-            features => features.has(DISCO_REMOTE_CONTROL_FEATURE),
96
-            () => false);
94
+        return user.getFeatures()
95
+            .then(features => features.has(DISCO_REMOTE_CONTROL_FEATURE));
97
     }
96
     }
98
 }
97
 }
99
 
98
 

Loading…
取消
儲存