瀏覽代碼

Log an error using less scary words

master
Lyubo Marinov 7 年之前
父節點
當前提交
ba61876b13
共有 1 個檔案被更改,包括 12 行新增1 行删除
  1. 12
    1
      modules/UI/videolayout/VideoContainer.js

+ 12
- 1
modules/UI/videolayout/VideoContainer.js 查看文件

@@ -10,6 +10,8 @@ export const VIDEO_CONTAINER_TYPE = 'camera';
10 10
 
11 11
 const FADE_DURATION_MS = 300;
12 12
 
13
+const logger = require('jitsi-meet-logger').getLogger(__filename);
14
+
13 15
 /**
14 16
  * Returns an array of the video dimensions, so that it keeps it's aspect
15 17
  * ratio and fits available area with it's larger dimension. This method
@@ -617,6 +619,15 @@ export class VideoContainer extends LargeContainer {
617 619
      */
618 620
     _showVideoBackground() {
619 621
         this.$videoBackground.css({ visibility: 'visible' });
620
-        this.$videoBackground[0].play();
622
+
623
+        // XXX HTMLMediaElement.play's Promise may be rejected. Certain
624
+        // environments such as Google Chrome and React Native will report the
625
+        // rejection as unhandled. And that may appear scary depending on how
626
+        // the environment words the report. To reduce the risk of scaring a
627
+        // developer, make sure that the rejection is handled. We cannot really
628
+        // do anything substantial about the rejection and, more importantly, we
629
+        // do not care.
630
+        this.$videoBackground[0].play()
631
+            .catch(reason => logger.error(reason));
621 632
     }
622 633
 }

Loading…
取消
儲存