ソースを参照

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 6年前
コミット
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,8 +893,10 @@ const VideoLayout = {
893 893
      * will be set.
894 894
      */
895 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,9 +91,8 @@ class RemoteControl extends EventEmitter {
91 91
      * the user supports remote control and with false if not.
92 92
      */
93 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
 

読み込み中…
キャンセル
保存