Selaa lähdekoodia

Makes video aspect ratio an optional constraint in order to fix failures in which available resolutions meet the constraints on the width and height of a requested resolution but none of the available resolutions satisfy the constraint with respect to aspect ratio.

j8
Lyubomir Marinov 11 vuotta sitten
vanhempi
commit
7c16d55094
1 muutettua tiedostoa jossa 10 lisäystä ja 8 poistoa
  1. 10
    8
      libs/strophe/strophe.jingle.adapter.js

+ 10
- 8
libs/strophe/strophe.jingle.adapter.js Näytä tiedosto

@@ -510,7 +510,7 @@ function getUserMediaWithConstraints(um, success_callback, failure_callback, res
510 510
     var constraints = {audio: false, video: false};
511 511
 
512 512
     if (um.indexOf('video') >= 0) {
513
-        constraints.video = {mandatory: {}};// same behaviour as true
513
+        constraints.video = { mandatory: {}, optional: [] };// same behaviour as true
514 514
     }
515 515
     if (um.indexOf('audio') >= 0) {
516 516
         constraints.audio = {};// same behaviour as true
@@ -523,7 +523,8 @@ function getUserMediaWithConstraints(um, success_callback, failure_callback, res
523 523
                 maxWidth: window.screen.width,
524 524
                 maxHeight: window.screen.height,
525 525
                 maxFrameRate: 3
526
-            }
526
+            },
527
+            optional: []
527 528
         };
528 529
     }
529 530
     if (um.indexOf('desktop') >= 0) {
@@ -535,7 +536,8 @@ function getUserMediaWithConstraints(um, success_callback, failure_callback, res
535 536
                 maxWidth: window.screen.width,
536 537
                 maxHeight: window.screen.height,
537 538
                 maxFrameRate: 3
538
-            }
539
+            },
540
+            optional: []
539 541
         }
540 542
     }
541 543
 
@@ -543,7 +545,7 @@ function getUserMediaWithConstraints(um, success_callback, failure_callback, res
543 545
     var isAndroid = navigator.userAgent.indexOf('Android') != -1;
544 546
 
545 547
     if (resolution && !constraints.video || isAndroid) {
546
-        constraints.video = {mandatory: {}};// same behaviour as true
548
+        constraints.video = { mandatory: {}, optional: [] };// same behaviour as true
547 549
     }
548 550
     // see https://code.google.com/p/chromium/issues/detail?id=143631#c9 for list of supported resolutions
549 551
     switch (resolution) {
@@ -552,23 +554,23 @@ function getUserMediaWithConstraints(um, success_callback, failure_callback, res
552 554
         case 'fullhd':
553 555
             constraints.video.mandatory.minWidth = 1920;
554 556
             constraints.video.mandatory.minHeight = 1080;
555
-            constraints.video.mandatory.minAspectRatio = 1.77;
557
+            constraints.video.optional.push({ minAspectRatio: 1.77 });
556 558
             break;
557 559
         case '720':
558 560
         case 'hd':
559 561
             constraints.video.mandatory.minWidth = 1280;
560 562
             constraints.video.mandatory.minHeight = 720;
561
-            constraints.video.mandatory.minAspectRatio = 1.77;
563
+            constraints.video.optional.push({ minAspectRatio: 1.77 });
562 564
             break;
563 565
         case '360':
564 566
             constraints.video.mandatory.minWidth = 640;
565 567
             constraints.video.mandatory.minHeight = 360;
566
-            constraints.video.mandatory.minAspectRatio = 1.77;
568
+            constraints.video.optional.push({ minAspectRatio: 1.77 });
567 569
             break;
568 570
         case '180':
569 571
             constraints.video.mandatory.minWidth = 320;
570 572
             constraints.video.mandatory.minHeight = 180;
571
-            constraints.video.mandatory.minAspectRatio = 1.77;
573
+            constraints.video.optional.push({ minAspectRatio: 1.77 });
572 574
             break;
573 575
         // 4:3
574 576
         case '960':

Loading…
Peruuta
Tallenna