Browse Source

Test RTCRtpReceiver.getCapabilities before using

 RTCRtpReceiver.getCapabilities could be undefined on some platforms
dev1
Jerry Hu 4 years ago
parent
commit
d12035874f
1 changed files with 1 additions and 0 deletions
  1. 1
    0
      modules/RTC/CodecSelection.js

+ 1
- 0
modules/RTC/CodecSelection.js View File

@@ -94,6 +94,7 @@ export class CodecSelection {
94 94
         }
95 95
 
96 96
         return window.RTCRtpReceiver
97
+            && window.RTCRtpReceiver.getCapabilities
97 98
             && window.RTCRtpReceiver.getCapabilities('video').codecs
98 99
             .some(codec => codec.mimeType.toLowerCase() === `video/${preferredCodec}`);
99 100
     }

Loading…
Cancel
Save