瀏覽代碼

Fixes error type when we succeed with one of the media.

Finds correct error when getUserMedia succeed with only one of the audio or video, and the other fails.
dev1
damencho 9 年之前
父節點
當前提交
587826f19f
共有 1 個檔案被更改,包括 29 行新增5 行删除
  1. 29
    5
      modules/RTC/RTCUtils.js

+ 29
- 5
modules/RTC/RTCUtils.js 查看文件

1036
                                     devices.push("video");
1036
                                     devices.push("video");
1037
                                 }
1037
                                 }
1038
 
1038
 
1039
-                                reject(new JitsiTrackError(
1040
-                                    { name: "UnknownError" },
1041
-                                    getConstraints(options.devices, options),
1042
-                                    devices)
1043
-                                );
1039
+                                // we are missing one of the media we requested
1040
+                                // in order to get the actual error that caused
1041
+                                // this missing media we will call one more time
1042
+                                // getUserMedia so we can obtain the actual
1043
+                                // error (Example usecases are requesting
1044
+                                // audio and video and video device is missing
1045
+                                // or device is denied to be used and chrome is
1046
+                                // set to not ask for permissions)
1047
+                                self.getUserMediaWithConstraints(
1048
+                                    devices,
1049
+                                    function (stream) {
1050
+                                        // we already failed to obtain this
1051
+                                        // media, so we are not supposed in any
1052
+                                        // way to receive success for this call
1053
+                                        // any way we will throw an error to be
1054
+                                        // sure the promise will finish
1055
+                                        reject(new JitsiTrackError(
1056
+                                            { name: "UnknownError" },
1057
+                                            getConstraints(
1058
+                                                options.devices, options),
1059
+                                            devices)
1060
+                                        );
1061
+                                    },
1062
+                                    function (error) {
1063
+                                        // rejects with real error for not
1064
+                                        // obtaining the media
1065
+                                        reject(error);
1066
+                                    },options);
1067
+
1044
                                 return;
1068
                                 return;
1045
                             }
1069
                             }
1046
                             if(hasDesktop) {
1070
                             if(hasDesktop) {

Loading…
取消
儲存